/* ==========================================
   STS PO IMPORT SYSTEM
   Smart Tech Solution
========================================== */

*{
    margin:0;
    padding:0;
    box-sizing:border-box;
    font-family:"Segoe UI",sans-serif;
}

body{
    background:linear-gradient(135deg,#edf7ef 0%,#f7faf8 55%,#e6f2e8 100%);

    display:flex;
    justify-content:center;
    align-items:center;

    min-height:100vh;

    padding:16px;

}

/* ==========================================
   CARD
========================================== */

.container{
    width:680px;
    max-width:100%;

    background:#fff;

    border-radius:18px;

    overflow:hidden;

    box-shadow:0 15px 45px rgba(0,0,0,.15);

}

/* ==========================================
   HEADER
========================================== */

.header{
    background:linear-gradient(135deg,#287d45,#51b65e);

    color:#fff;

    text-align:center;

    padding:26px 24px 24px;

}

.logo{
    width:145px;

    height:auto;

    display:block;

    margin:0 auto 15px;

}

.header h1{

    font-size:34px;

    font-weight:700;

    letter-spacing:.5px;

}

.header h2{
    font-size:30px;
    font-weight:700;
    letter-spacing:.5px;
}

.header p{

    margin-top:8px;

    opacity:.95;

    font-size:16px;

}

.badge{

    display:inline-block;

    margin-top:18px;

    padding:8px 20px;

    border-radius:30px;

    background:rgba(255,255,255,.18);

    backdrop-filter:blur(5px);

    font-size:14px;

}

.connection{
    display:inline-flex;
    align-items:center;
    gap:8px;
    margin-top:18px;
    padding:8px 16px;
    border:1px solid rgba(255,255,255,.28);
    border-radius:999px;
    background:rgba(255,255,255,.14);
    font-size:13px;
}

.connection-dot{
    width:8px;
    height:8px;
    border-radius:50%;
    background:#b9f6ca;
    box-shadow:0 0 0 4px rgba(185,246,202,.18);
}

/* ==========================================
   CONTENT
========================================== */

.content{
    padding:30px 32px 24px;

    text-align:center;

}

.content h2{

    color:#2f3542;

    font-size:27px;

    margin-bottom:10px;

}

.subtitle{

    color:#666;

    margin-bottom:25px;

    line-height:1.6;

}

/* ==========================================
   UPLOAD BOX
========================================== */

.upload-box{

    display:block;

    border:3px dashed #8BC34A;

    border-radius:18px;

    background:#F8FFF5;

    padding:32px 20px;

    cursor:pointer;

    transition:.30s;

}

.upload-box:hover{

    background:#eefce8;

    border-color:#4CAF50;

    transform:translateY(-2px);

}

.upload-box.dragging{
    background:#e4f8df;
    border-color:#287d45;
    transform:scale(1.01);
}

.upload-box input{

    display:none;

}

.upload-icon{
    font-size:50px;

    margin-bottom:15px;

}

/* ==========================================
   INLINE ICONS

   Buttons and labels draw a stroke icon instead of an emoji or dingbat
   character: the same shape on every machine, and it inherits the text
   colour, so a hover state colours it too. Sized in `em` so one rule
   fits a 13px button and a 50px drop-zone alike.
========================================== */

.ic{
    display:inline-block;
    width:1.15em;
    height:1.15em;
    flex:0 0 auto;
    vertical-align:-0.18em;
    fill:none;
    stroke:currentColor;
    stroke-width:1.8;
    stroke-linecap:round;
    stroke-linejoin:round;
}

/* A big solitary icon (the upload drop-zone) centres itself. */
.upload-icon .ic,
.pf-drop-icon .ic{
    display:block;
    width:1.6em;
    height:1.6em;
    margin:0 auto;
    stroke-width:1.5;
}

.upload-title{
    font-size:24px;

    font-weight:bold;

    color:#333;

    margin-bottom:10px;

}

.upload-subtitle{

    color:#777;

    font-size:15px;

}

#file-name{

    display:block;

    margin-top:20px;

    color:#2E7D32;

    font-size:17px;

    font-weight:600;

}

.excel-preview{
    margin-top:20px;
    padding:18px;
    border:1px solid #dce8dc;
    border-radius:12px;
    background:#fbfefb;
    text-align:left;
}

.preview-header{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
    margin-bottom:12px;
}

.preview-header h3{
    margin:0;
    color:#2f3542;
    font-size:17px;
}

.preview-header p,
.preview-note{
    margin:4px 0 0;
    color:#778177;
    font-size:12px;
}

.preview-badge{
    padding:4px 9px;
    border-radius:999px;
    background:#e5f5e3;
    color:#2e7d32;
    font-size:11px;
    font-weight:700;
    text-transform:uppercase;
}

.preview-table-wrap{
    overflow-x:auto;
    border:1px solid #e1e9e1;
    border-radius:8px;
    background:#fff;
}

.preview-table-wrap table{
    width:100%;
    border-collapse:collapse;
    font-size:12px;
    white-space:nowrap;
}

.preview-table-wrap th,
.preview-table-wrap td{
    max-width:180px;
    overflow:hidden;
    padding:9px 10px;
    border-bottom:1px solid #edf1ed;
    text-overflow:ellipsis;
}

.preview-table-wrap th{
    background:#f1f8ef;
    color:#315b35;
    font-weight:700;
    text-align:left;
}

.preview-table-wrap tr:last-child td{
    border-bottom:none;
}

.preview-note{
    margin-bottom:0;
}

/* ==========================================
   BUTTON
========================================== */

.btn-import{

    width:100%;

    margin-top:20px;
    padding:15px;

    border:none;

    border-radius:12px;

    background:linear-gradient(135deg,#55ad3a,#318b43);

    color:white;

    font-size:18px;

    font-weight:bold;

    cursor:pointer;

    transition:.25s;

}

.btn-import:disabled{
    cursor:wait;
    opacity:.7;
    transform:none;
}

.btn-import:hover{

    background:#419421;

    transform:translateY(-2px);

    box-shadow:0 10px 20px rgba(0,0,0,.15);

}

/* ==========================================
   STATUS
========================================== */

.status{
    padding:0 32px 22px;

}

.status-item{

    display:flex;

    justify-content:space-between;

    align-items:center;

    background:#f7f7f7;

    border:1px solid #e4e4e4;

    border-radius:12px;

    padding:18px;

}

.title{

    color:#666;

    font-weight:600;

}

#status-text{
    color:#2E7D32;

    font-weight:bold;

}

.status-item{
    box-shadow:0 4px 12px rgba(31,72,44,.05);
}

/* ==========================================
   LOADING
========================================== */

.loading{

    display:none;

    text-align:center;

    padding:14px;

    color:#2E7D32;

    font-weight:600;

}

.spinner{

    width:36px;

    height:36px;

    margin:0 auto 12px;

    border:4px solid #ddd;

    border-top:4px solid #5CB338;

    border-radius:50%;

    animation:spin .8s linear infinite;

}

@keyframes spin{

    to{

        transform:rotate(360deg);

    }

}

/* ==========================================
   FOOTER
========================================== */

.footer{

    background:#fafafa;

    border-top:1px solid #eee;

    padding:13px 15px;

    text-align:center;

    color:#888;

    font-size:13px;

}
/* ==========================================
   RESULT PAGE
========================================== */

.result-box{

    padding:35px;

    text-align:center;

}

.success-icon{

    font-size:80px;

    margin-bottom:15px;

    color:#2E7D32;

}

.result-title{

    font-size:32px;

    color:#2E7D32;

    margin-bottom:10px;

}

.result-desc{

    color:#666;

    margin-bottom:30px;

    line-height:1.6;

}

/* ==========================================
   RESULT TABLE
========================================== */

.result-table{

    width:100%;

    border-collapse:collapse;

    margin:25px 0;

    border-radius:12px;

    overflow:hidden;

    box-shadow:0 3px 12px rgba(0,0,0,.05);

}

.result-table tr{

    border-bottom:1px solid #ececec;

    transition:.2s;

}

.result-table tr:hover{

    background:#F8FFF5;

}

.result-table td{

    padding:15px;

    font-size:16px;

}

.result-table td:first-child{

    width:220px;

    background:#fafafa;

    color:#555;

    font-weight:600;

}

.result-table td:last-child{

    color:#2E7D32;

    font-weight:600;

}

/* ==========================================
   SUCCESS / FAILED
========================================== */

.success{

    color:#2E7D32;

    font-weight:bold;

}

.failed{

    color:#E53935;

    font-weight:bold;

}

/* ==========================================
   IMPORT SUMMARY
========================================== */

.summary{

    margin-top:25px;

    padding:20px;

    background:#F8FFF5;

    border:1px solid #D6F0C3;

    border-radius:14px;

    text-align:left;

}

.summary h3{

    margin-bottom:15px;

    color:#2E7D32;

}

.summary p{

    margin:8px 0;

    color:#444;

    font-size:15px;

}

/* ==========================================
   BUTTON BACK
========================================== */

.btn-back{

    display:inline-block;

    margin-top:20px;

    text-decoration:none;

    background:#5CB338;

    color:#fff;

    padding:14px 40px;

    border-radius:10px;

    font-weight:bold;

    transition:.25s;

}

.btn-back:hover{

    background:#419421;

    transform:translateY(-2px);

    box-shadow:0 8px 18px rgba(0,0,0,.18);

}

/* ==========================================
   SCROLLBAR
========================================== */

::-webkit-scrollbar{

    width:8px;

}

::-webkit-scrollbar-thumb{

    background:#76C043;

    border-radius:20px;

}

::-webkit-scrollbar-track{

    background:#edf3ef;

}

/* ==========================================
   RESPONSIVE
========================================== */

@media(max-width:768px){

.container{
    width:100%;
}

body{
    align-items:flex-start;
    padding:8px;
}

.header{
    padding:20px 16px 18px;

}

.logo{
    width:115px;

    margin-bottom:15px;

}

.header h1{

    font-size:28px;

}

.header p{

    font-size:14px;

}

.badge{

    font-size:13px;

    padding:7px 16px;

}

.content{
    padding:22px 16px 18px;
}

.content h2{

    font-size:24px;

}

.subtitle{

    font-size:14px;

}

.upload-box{
    padding:25px 14px;

}

.upload-title{

    font-size:22px;

}

.upload-subtitle{

    font-size:14px;

}

.upload-icon{

    font-size:48px;

}

.result-box{

    padding:25px;

}

.result-title{

    font-size:26px;

}

.result-table td{

    font-size:14px;

    padding:12px;

}

.result-table td:first-child{

    width:150px;

}

.status{
    padding:0 16px 16px;
}

.footer{

    font-size:12px;

}

}

/* ==========================================
   RESULT ICON TONES
========================================== */

.result-icon{
    font-size:80px;
    line-height:1;
    margin-bottom:15px;
}

/* The status icon is inline SVG, not an emoji: it inherits the tone
   colour set below instead of whatever colour the system font ships. */
.result-icon svg{
    display:block;
    width:80px;
    height:80px;
    margin:0 auto;
    fill:none;
    stroke:currentColor;
    stroke-width:1.8;
    stroke-linecap:round;
    stroke-linejoin:round;
}

.result-icon--ok{
    color:#2E7D32;
}

.result-icon--warn{
    color:#EF6C00;
}

.result-icon--bad{
    color:#E53935;
}

.result-title--ok{
    color:#2E7D32;
}

.result-title--warn{
    color:#EF6C00;
}

.result-title--bad{
    color:#E53935;
}

.result-hint{
    margin-top:16px;
    color:#777;
    font-size:14px;
}

/* ==========================================
   ALERTS
========================================== */

.alert{
    margin:22px 0;
    padding:18px 20px;
    border-radius:12px;
    text-align:left;
    font-size:15px;
    line-height:1.6;
}

.alert strong{
    display:block;
    margin-bottom:6px;
    font-size:16px;
}

.alert p{
    margin:8px 0 0;
}

.alert p:first-child{
    margin-top:0;
}

.alert ul{
    margin:10px 0 0;
    padding-left:20px;
}

.alert--warn{
    background:#FFF8E1;
    border:1px solid #FFE082;
    color:#7A4F01;
}

.alert--bad{
    background:#FFEBEE;
    border:1px solid #FFCDD2;
    color:#8E1F1F;
}

/* ==========================================
   PER-PO BREAKDOWN
========================================== */

.breakdown{
    margin-top:28px;
    text-align:left;
}

.breakdown h3{
    margin-bottom:12px;
    color:#2f3542;
    font-size:18px;
}

.breakdown-wrap{
    overflow-x:auto;
    border:1px solid #e1e9e1;
    border-radius:12px;
    background:#fff;
}

.breakdown table{
    width:100%;
    border-collapse:collapse;
    font-size:14px;
    white-space:nowrap;
}

.breakdown th,
.breakdown td{
    padding:12px 14px;
    border-bottom:1px solid #edf1ed;
    text-align:left;
}

.breakdown th{
    background:#f1f8ef;
    color:#315b35;
    font-size:13px;
    font-weight:700;
}

.breakdown tr:last-child td{
    border-bottom:none;
}

.pill{
    display:inline-block;
    padding:4px 10px;
    border-radius:999px;
    font-size:11px;
    font-weight:700;
    letter-spacing:.3px;
}

.pill--imported{
    background:#E8F5E9;
    color:#2E7D32;
}

.pill--duplicate{
    background:#FFF8E1;
    color:#8D6E00;
}

.pill--failed{
    background:#FFEBEE;
    color:#C62828;
}

.pill--incomplete{
    background:#FFF3E0;
    color:#E65100;
}

.pill-note{
    display:block;
    margin-top:6px;
    color:#888;
    font-size:12px;
    white-space:normal;
}

/* ==========================================
   TEMPLATE HINT
========================================== */

.hint-bar{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    justify-content:center;
    gap:12px;
    margin-bottom:22px;
}

.template-link{
    display:inline-flex;
    align-items:center;
    gap:8px;
    padding:10px 18px;
    border:1px solid #cfe6cf;
    border-radius:999px;
    background:#f4fbf3;
    color:#2E7D32;
    font-size:14px;
    font-weight:600;
    text-decoration:none;
    transition:.2s;
}

.template-link:hover{
    background:#e6f6e4;
    border-color:#8BC34A;
}

@media(max-width:768px){

    .result-icon{

        font-size:60px;

    }

    .hint-bar{

        flex-direction:column;
        align-items:stretch;

    }

    .template-link{

        justify-content:center;

    }

    .breakdown table{

        font-size:12px;

    }

    .breakdown th,
    .breakdown td{

        padding:10px;

    }

}

/* ==========================================
   MANUAL ENTRY GRID
========================================== */

.container--wide{
    width:1120px;
}

.content--left{
    text-align:left;
}

.alert-note{
    margin-top:10px;
    font-size:13px;
    opacity:.85;
}

.grid-toolbar{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:10px;
    margin-bottom:14px;
}

.btn-secondary{
    padding:9px 16px;
    border:1px solid #cfe6cf;
    border-radius:999px;
    background:#f4fbf3;
    color:#2E7D32;
    font-size:14px;
    font-weight:600;
    font-family:inherit;
    cursor:pointer;
    transition:.2s;
}

.btn-secondary:hover{
    background:#e6f6e4;
    border-color:#8BC34A;
}

.grid-hint{
    color:#888;
    font-size:13px;
}

.grid-wrap{
    overflow-x:auto;
    border:1px solid #e1e9e1;
    border-radius:12px;
    background:#fff;
}

.entry-table{
    width:100%;
    border-collapse:collapse;
    font-size:14px;
}

.entry-table th{
    padding:10px 8px;
    border-bottom:1px solid #dce8dc;
    background:#f1f8ef;
    color:#315b35;
    font-size:12px;
    font-weight:700;
    text-align:left;
    white-space:nowrap;
}

.entry-table td{
    padding:4px 6px;
    border-bottom:1px solid #edf1ed;
    vertical-align:middle;
}

.entry-table tr:last-child td{
    border-bottom:none;
}

.entry-table .col-no{
    width:38px;
    color:#999;
    font-size:12px;
    text-align:center;
}

.entry-table .col-action{
    width:78px;
    white-space:nowrap;
}

.cell-input{
    width:100%;
    min-width:124px;
    padding:8px 10px;
    border:1px solid transparent;
    border-radius:8px;
    background:#fbfdfb;
    color:#2f3542;
    font-family:inherit;
    font-size:14px;
}

.cell-input:focus{
    outline:none;
    border-color:#8BC34A;
    background:#fff;
    box-shadow:0 0 0 3px rgba(139,195,74,.18);
}

.cell-input--qty{
    min-width:80px;
    text-align:right;
}

.cell-input--date{
    min-width:152px;
}

.cell-input--locked{
    border-color:#e0e6e0;
    background:#eef2ee;
    color:#5a6b5a;
    cursor:not-allowed;
}

.cell-input--locked:focus{
    border-color:#d5ded5;
    background:#eef2ee;
    box-shadow:none;
}

.btn-icon{
    width:30px;
    height:30px;
    border:1px solid #e0e6e0;
    border-radius:8px;
    background:#fff;
    color:#5a6b5a;
    font-size:13px;
    line-height:1;
    cursor:pointer;
    transition:.2s;
}

.btn-icon:hover{
    background:#eef7ec;
    border-color:#8BC34A;
    color:#2E7D32;
}

.btn-icon--danger:hover{
    background:#FFEBEE;
    border-color:#EF9A9A;
    color:#C62828;
}

.entry-table tr.row-error td{
    background:#FFF5F5;
}

.entry-table tr.row-error .cell-input{
    border-color:#EF9A9A;
    background:#FFF8F8;
}

.grid-note{
    margin-top:12px;
    color:#888;
    font-size:13px;
}

/* ==========================================
   INCOMING STOCK
========================================== */

.stat-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(160px,1fr));
    gap:14px;
    margin:18px 0 22px;
}

.stat{
    background:#f6faf7;
    border:1px solid #e2ede5;
    border-left:5px solid #9db8a6;
    border-radius:12px;
    padding:14px 16px;
    display:flex;
    flex-direction:column;
    gap:4px;
}

.stat--incoming{
    border-left-color:#e0a800;
    background:#fffaf0;
}

.stat--received{
    border-left-color:#287d45;
    background:#f2faf4;
}

.stat-label{
    font-size:12px;
    letter-spacing:.04em;
    text-transform:uppercase;
    color:#6c7d72;
    font-weight:600;
}

.stat-value{
    font-size:26px;
    font-weight:700;
    color:#24503a;
    line-height:1.1;
}

.stat-note{
    font-size:12px;
    color:#8a9a90;
}

.alert--ok{
    background:#f2faf4;
    border-left:5px solid #287d45;
    color:#1f5c34;
}

.filter-bar{
    margin:14px 0 6px;
}

.filter-tabs{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    margin-bottom:12px;
}

.tab{
    display:inline-flex;
    align-items:center;
    gap:8px;
    padding:8px 14px;
    border-radius:999px;
    border:1px solid #d8e6dc;
    background:#fff;
    color:#3d5a48;
    text-decoration:none;
    font-size:13px;
    font-weight:600;
}

.tab:hover{
    background:#f2faf4;
    border-color:#51b65e;
}

.tab--active{
    background:#287d45;
    border-color:#287d45;
    color:#fff;
}

.tab-count{
    background:rgba(0,0,0,.08);
    border-radius:999px;
    padding:1px 7px;
    font-size:11px;
}

.tab--active .tab-count{
    background:rgba(255,255,255,.25);
}

.filter-search{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    align-items:center;
}

.filter-search input[type=text]{
    flex:1 1 240px;
    min-width:180px;
    padding:10px 12px;
    border:1px solid #d8e6dc;
    border-radius:10px;
    font-size:14px;
    font-family:inherit;
}

.filter-search input[type=text]:focus{
    outline:none;
    border-color:#51b65e;
    box-shadow:0 0 0 3px rgba(81,182,94,.15);
}

.po-card{
    border:1px solid #e2ede5;
    border-left:5px solid #e0a800;
    border-radius:14px;
    margin:14px 0;
    overflow:hidden;
    background:#fff;
}

.po-card--received{
    border-left-color:#287d45;
}

.po-card--partial{
    border-left-color:#d98324;
}

.po-head{
    padding:12px 16px;
    background:#fafcfb;
    border-bottom:1px solid #eef4f0;
}

.po-title{
    display:flex;
    align-items:center;
    gap:10px;
    flex-wrap:wrap;
    font-size:15px;
}

.po-meta{
    display:flex;
    flex-wrap:wrap;
    gap:14px;
    margin-top:6px;
    font-size:12px;
    color:#6c7d72;
}

.tracking{
    background:#eef4f0;
    border-radius:6px;
    padding:1px 7px;
    font-family:Consolas,monospace;
}

.stock-table{
    width:100%;
    border-collapse:collapse;
    font-size:13px;
}

.stock-table th,
.stock-table td{
    padding:9px 12px;
    text-align:left;
    border-bottom:1px solid #f0f5f2;
    vertical-align:middle;
}

.stock-table th{
    background:#f6faf7;
    font-size:11px;
    text-transform:uppercase;
    letter-spacing:.04em;
    color:#6c7d72;
}

.stock-table tr:last-child td{
    border-bottom:none;
}

.stock-table .num{
    text-align:right;
    font-variant-numeric:tabular-nums;
    font-weight:600;
}

.stock-table .mono{
    font-family:Consolas,monospace;
    font-size:12px;
}

.stock-table .receive-col{
    width:190px;
    text-align:right;
}

.stock-table tr.row-received{
    background:#f7fbf8;
}

.receive-form{
    display:flex;
    gap:6px;
    justify-content:flex-end;
    align-items:center;
}

.qty-input{
    width:74px;
    padding:6px 8px;
    border:1px solid #d8e6dc;
    border-radius:8px;
    font-size:13px;
    font-family:inherit;
    text-align:right;
}

.qty-input:focus{
    outline:none;
    border-color:#51b65e;
    box-shadow:0 0 0 3px rgba(81,182,94,.15);
}

.btn-icon--ok{
    width:auto;
    padding:6px 12px;
    font-size:12px;
    font-weight:600;
    background:#287d45;
    color:#fff;
    border:none;
    border-radius:8px;
    cursor:pointer;
}

.btn-icon--ok:hover{
    background:#1f5c34;
}

.muted{
    color:#b3c2b9;
}

.pill--incoming{
    background:#fff4d6;
    color:#8a6100;
}

.pill--received{
    background:#dff3e4;
    color:#1f5c34;
}

.pill--partial{
    background:#fde9d3;
    color:#8a4b00;
}

/* A recalled approval is the one thing on this page that needs to shout. */
.pill--recalled{
    background:var(--red-tint);
    color:var(--red);
    font-weight:700;
}

.pill--rejected{
    background:#f6e8e7;
    color:#8c3a33;
}

.pill--review{
    background:#eef1f5;
    color:#48566b;
}

.pager{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:14px;
    margin:18px 0 4px;
}

.pager-info{
    font-size:13px;
    color:#6c7d72;
}

.stat--bad{
    border-left-color:#d32f2f;
    background:#fdf1f1;
}

.stat--bad .stat-value{
    color:#b3261e;
}

.stock-table tr.row-unresolved{
    background:#fdf1f1;
}

.stock-table tr.row-unresolved td{
    border-bottom-color:#f6dede;
}

.pill--failed{
    background:#fde3e3;
    color:#a01c1c;
}

.progress-bar{
    margin-top:10px;
    height:6px;
    border-radius:999px;
    background:#e8f0ea;
    overflow:hidden;
}

.progress-bar span{
    display:block;
    height:100%;
    background:linear-gradient(90deg,#51b65e,#287d45);
    border-radius:999px;
}

.progress-chip{
    font-size:11px;
    font-weight:700;
    color:#287d45;
    background:#e8f5ec;
    border-radius:999px;
    padding:2px 9px;
}

.meta-pending{
    color:#8a6100;
    font-weight:600;
}

.sub-mono{
    font-family:Consolas,monospace;
    font-size:11px;
    color:#8a9a90;
}

/* ==========================================
   OUTBOUND APPROVAL DASHBOARD
========================================== */

.approval-actions{
    display:flex;
    align-items:center;
    gap:10px;
    flex-wrap:wrap;
    padding:11px 16px;
    background:#fafcfb;
    border-top:1px solid #eef4f0;
}

.approval-actions form{
    margin:0;
}

.imported-note{
    color:#1f5c34;
    font-weight:600;
}

/* Warehouse Outbound city, shown as a small tag so the column stays
   narrow while the value is still easy to scan down. */
.city-tag{
    display:inline-block;
    padding:2px 9px;
    border-radius:20px;
    background:var(--brand-tint);
    color:var(--brand);
    font-size:12.5px;
    font-weight:600;
    white-space:nowrap;
}

/* One colour per city, so a column of them can be scanned without
   reading every label. The default above is the fallback. */
.city-tag--cikarang{
    background:#e8f1fb;
    color:#1b5e9e;
}

.city-tag--pekanbaru{
    background:#f3ecfa;
    color:#6b3fa0;
}

.city-tag--balikpapan{
    background:#e6f6f4;
    color:#146c62;
}

.city-tag--lain{
    background:var(--surface-3);
    color:var(--ink-soft);
}

/* ==========================================
   TOAST  (one-time status messages)
========================================== */

.toast-wrap{
    position:fixed;
    top:74px;
    right:22px;
    z-index:60;
    display:flex;
    flex-direction:column;
    gap:8px;
    align-items:flex-end;
    max-width:min(430px,calc(100vw - 36px));
    pointer-events:none;
}

.toast{
    pointer-events:auto;
    padding:11px 15px;
    border-radius:11px;
    border:1px solid var(--line);
    border-left:4px solid var(--brand);
    background:var(--surface);
    box-shadow:var(--shadow-2);
    font-size:13.5px;
    line-height:1.5;
    color:var(--ink);
    animation:toast-in .22s ease-out, toast-out .5s ease-in 7.5s forwards;
}

.toast:hover{
    animation-play-state:paused;
}

.toast--ok{
    border-left-color:var(--brand);
}

.toast--bad{
    border-left-color:var(--red);
}

.toast--warn{
    border-left-color:var(--amber);
    background:var(--amber-tint);
}

@keyframes toast-in{
    from{ opacity:0; transform:translateY(-8px); }
    to{ opacity:1; transform:translateY(0); }
}

@keyframes toast-out{
    to{ opacity:0; transform:translateY(-6px); visibility:hidden; }
}

@media(max-width:700px){
    .toast-wrap{
        top:auto;
        bottom:16px;
        right:12px;
        left:12px;
        max-width:none;
        align-items:stretch;
    }
}


/* ==========================================
   LABEL DESIGNER
========================================== */

.designer{
    display:flex;
    gap:16px;
    align-items:flex-start;
    flex-wrap:wrap;
    margin:6px 0 14px;
}

.designer-stage{
    flex:1 1 520px;
    min-width:0;
    padding:18px;
    border:1px solid var(--line);
    border-radius:12px;
    background:#f4f7f4;
    overflow:auto;
}

.designer-canvas{
    position:relative;
    background:#fff;
    border:1px solid #c9d3cc;
    box-shadow:var(--shadow-1);
}

.designer-hint{
    margin:8px 0 0;
    font-size:12px;
    color:var(--ink-soft);
}

.el{
    position:absolute;
    box-sizing:border-box;
    cursor:move;
    user-select:none;
    color:#111;
    overflow:hidden;
    line-height:1.05;
    outline:1px dashed transparent;
}

.el:hover{
    outline-color:#9fc4ac;
}

.el--on{
    outline:2px solid var(--brand);
    outline-offset:0;
}

.el--bars{
    background:repeating-linear-gradient(
        90deg,#111 0 1px,#fff 1px 3px
    );
    color:transparent;
    font-size:0;
}

.el--rect{
    border:1px solid #77807a;
}

.designer-side{
    flex:0 0 268px;
    display:flex;
    flex-direction:column;
    gap:8px;
    padding:14px;
    border:1px solid var(--line);
    border-radius:12px;
    background:var(--surface);
}

.side-field{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    font-size:13px;
}

.side-field span{
    color:var(--ink-soft);
}

.side-field .num-input,
.side-field .text-input,
.side-field select{
    width:142px;
}

.side-empty{
    margin:0;
    font-size:13px;
    color:var(--ink-soft);
}

.side-remove{
    margin-top:6px;
    width:100%;
}

.bar--print{
    margin-top:4px;
}

.bar-group--end{
    flex:0 0 auto;
    justify-content:flex-end;
}

.bar-sep{
    width:1px;
    height:22px;
    background:var(--line);
}

.text-input{
    padding:9px 11px;
    border:1px solid var(--line);
    border-radius:9px;
    font-size:13.5px;
    font-family:inherit;
}

/* ==========================================
   LABELS
========================================== */

.label-field{
    display:inline-flex;
    align-items:center;
    gap:8px;
    font-size:13.5px;
    color:var(--ink-soft);
}

.label-field span{
    font-weight:600;
}

.label-field select{
    padding:9px 13px;
    font-size:13.5px;
}

.label-field--check{
    cursor:pointer;
    padding:0 4px;
}

.label-field--check input[type=checkbox]{
    width:16px;
    height:16px;
    cursor:pointer;
    accent-color:var(--brand);
}

.label-field .num-input{
    width:74px;
    padding:9px 11px;
    font-size:13.5px;
    border:1px solid var(--line);
    border-radius:9px;
    font-family:inherit;
}

.label-table .label-qty{
    width:78px;
}

/* The put-away location printed on each label. It comes from INCOMING
   STOCK but stays editable here, because the shelf is often only decided
   when the goods are unpacked. */
.label-table .label-location{
    width:96px;
    padding:7px 9px;
    font-size:13px;
    font-family:inherit;
    border:1px solid var(--line);
    border-radius:8px;
    text-transform:uppercase;
}

.label-table .label-location:disabled{
    opacity:.4;
}

/* The CIPL label run: a search box and the pick count above the table. */
.cipl-toolbar{
    margin:0 0 10px;
}

.cipl-picked{
    font-size:12.5px;
    color:var(--ink-dim);
    white-space:nowrap;
}

.cipl-picked strong{
    color:var(--ink);
    font-variant-numeric:tabular-nums;
}

/* A filtered-out material is out of the run, so it is hidden rather than
   dimmed - dimming is how an unticked row already reads. */
.label-table tr.is-hidden{
    display:none;
}

.grid-hint.is-hidden{
    display:none;
}

/* Hidden rack-allocation page: a plain section heading between tables. */
.rak-section{
    margin:26px 0 10px;
    font-size:14px;
    font-weight:700;
    color:var(--ink-soft);
    text-transform:uppercase;
    letter-spacing:.04em;
}

/* A checkbox that sits in the tool bar like the other fields. */
.label-field--check{
    flex-direction:row;
    align-items:center;
    gap:7px;
    align-self:center;
    font-size:13px;
    cursor:pointer;
}

.label-field--check input[type=checkbox]{
    width:16px;
    height:16px;
    cursor:pointer;
    accent-color:var(--brand);
}

.label-table code{
    font-size:12.5px;
}

/* Per-material selection: a narrow checkbox column, and a dimmed row so
   it is obvious at a glance which materials will not be printed. */
.label-table th.pick,
.label-table td.pick{
    width:38px;
    text-align:center;
    padding-left:8px;
    padding-right:4px;
}

.label-table input[type=checkbox]{
    width:16px;
    height:16px;
    cursor:pointer;
    accent-color:var(--brand);
}

.label-table tr.row--off{
    opacity:.42;
}

.label-table tr.row--off .label-qty{
    pointer-events:none;
}

/* Compact outbound dashboard */

.header--slim{
    padding:14px 20px;
}

.header--slim h2{
    font-size:18px;
    margin:4px 0 2px;
}

.header--slim p{
    font-size:12px;
}

/* A slim header that also carries an action button on the right, so the
   button does not have to compete with the search field in the toolbar. */
.header--action{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
    flex-wrap:wrap;
}

.header--action .header-text{
    min-width:0;
}

.header--action h2{
    margin-top:0;
}

.bar{
    display:flex;
    align-items:center;
    gap:10px;
    flex-wrap:wrap;
    margin:4px 0 12px;
}

.bar-group{
    display:flex;
    align-items:center;
    gap:8px;
    flex:1 1 320px;
    margin:0;
}

.bar-group input[type=text]{
    flex:1 1 auto;
    min-width:160px;
    padding:8px 11px;
    border:1px solid #d8e6dc;
    border-radius:9px;
    font-size:13px;
    font-family:inherit;
}

.inline-form{
    display:inline;
    margin:0;
}

.inline-form button{
    font-family:inherit;
}

.chips{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    align-items:center;
    margin-bottom:12px;
}

.chip{
    padding:5px 11px;
    border-radius:999px;
    border:1px solid #d8e6dc;
    background:#fff;
    color:#3d5a48;
    text-decoration:none;
    font-size:12px;
    font-weight:600;
    white-space:nowrap;
}

.chip:hover{
    border-color:#51b65e;
    background:#f2faf4;
}

.chip--on{
    background:#287d45;
    border-color:#287d45;
    color:#fff;
}

.chip-divider{
    width:1px;
    height:18px;
    background:#dbe7df;
    margin:0 4px;
}

.outbound-table td,
.outbound-table th{
    padding:8px 10px;
}

.outbound-row{
    cursor:pointer;
}

.outbound-row:hover{
    background:#f6faf7;
}

.expander{
    font-family:Consolas,monospace;
    font-size:12px;
    font-weight:600;
    color:#287d45;
    text-decoration:none;
}

/* The drawer row is hidden with the `hidden` attribute, which the UA
   sheet turns into `display:none`. An earlier feature also had
   `display:none` here unconditionally; being more specific than the
   attribute, it kept the drawer closed even when the toggle opened it.
   Only the *not hidden* case needs a rule now. */
.items-row:not([hidden]){
    display:table-row;
}

.items-row > td{
    background:#fafcfb;
    padding:0;
}

.mini-table{
    width:100%;
    border-collapse:collapse;
    font-size:12px;
}

.mini-table td{
    padding:6px 12px;
    border-bottom:1px solid #f0f5f2;
}

.mini-table tr:last-child td{
    border-bottom:none;
}

.action-cell{
    white-space:nowrap;
    text-align:right;
}

.btn-mini{
    padding:5px 10px;
    border-radius:7px;
    border:1px solid #287d45;
    background:#287d45;
    color:#fff;
    font-size:12px;
    font-weight:600;
    cursor:pointer;
}

.btn-mini:hover{
    background:#1f5c34;
}

.btn-mini--ghost{
    background:#fff;
    color:#3d5a48;
    border-color:#d8e6dc;
}

.btn-mini--ghost:hover{
    background:#f2faf4;
    border-color:#51b65e;
}

@media(max-width:768px){

    .cell-input{

        min-width:100px;

    }

    .grid-toolbar{

        flex-direction:column;
        align-items:stretch;

    }

    .grid-hint{

        text-align:center;

    }

    .stock-table .receive-col{
        width:auto;
    }

}

/* ==========================================================
   THEME  (loaded last: overrides everything above)

   One coherent set of tokens, larger type and controls for desktop
   browsing, and a shared top navigation. Kept in one block so the look
   can be adjusted without hunting through the older rules.
========================================================== */

:root{

    --ink:#16241c;
    --ink-soft:#4b6156;
    --ink-dim:#7b8f84;

    --line:#e2eae5;
    --line-soft:#eef4f0;

    --surface:#fff;
    --surface-2:#f7faf8;
    --surface-3:#f1f6f3;

    --brand:#26794a;
    --brand-2:#3e9d5c;
    --brand-ink:#1c5d38;
    --brand-tint:#eaf6ee;

    /* The sidebar's accent; declared here so every block can use it. */
    --forest:#2E6F40;

    --amber:#b07300;
    --amber-tint:#fff6e3;

    --red:#b3261e;
    --red-tint:#fdf0ef;

    --r-sm:9px;
    --r-md:12px;
    --r-lg:16px;

    --shadow-1:0 1px 2px rgba(16,40,26,.05), 0 1px 3px rgba(16,40,26,.05);
    --shadow-2:0 6px 20px rgba(16,40,26,.09);
}

body{

    background:linear-gradient(180deg,#eef5f0 0%,#f6faf7 40%,#eaf3ed 100%);

    font-size:15px;

    color:var(--ink);

    align-items:flex-start;

    padding:0;

}

/* ---- shell ---- */

.container,
.container--wide{

    width:min(1480px,100%);

    max-width:100%;

    margin:0 auto;

    background:var(--surface);

    border-radius:0;

    box-shadow:none;

    min-height:100vh;

}

/* A page that has the sidebar is the full-page shell, not a centered
   card. The card rule earlier sets overflow:hidden, which makes the
   container a scroll container and silently stops `position:sticky` on
   the sidebar from working - the panel scrolled away with the page
   instead of staying pinned.

   `container--shell` is added by the sidebar script, so the sidebar-less
   card pages (index/result/error) keep their rounded clipping; the :has()
   selector is a no-script fallback for browsers that support it. */
.container--shell,
.container--wide.container--shell,
.container:has(> .sidebar),
.container--wide:has(> .sidebar){
    overflow:visible;
}

/* ---- top navigation ---- */

.nav{

    position:sticky;

    top:0;

    z-index:40;

    display:flex;

    align-items:center;

    gap:8px;

    padding:12px 26px;

    background:linear-gradient(120deg,#1f6b41,#2f8f55);

    box-shadow:var(--shadow-2);

}

.nav-brand{

    display:flex;

    align-items:center;

    gap:11px;

    margin-right:20px;

    color:#fff;

    text-decoration:none;

    font-weight:700;

    font-size:16px;

    letter-spacing:.2px;

    white-space:nowrap;

}

.nav-brand img{
    /* The nav shows the wordmark only - the logo lockup is too tall to
       read at this size. */
    display:none;
}

.nav-links{

    display:flex;

    gap:6px;

    flex-wrap:wrap;

    flex:1;

}

.nav-link{

    display:inline-flex;

    align-items:center;

    gap:7px;

    padding:9px 15px;

    border-radius:10px;

    color:rgba(255,255,255,.9);

    text-decoration:none;

    font-size:14px;

    font-weight:500;

    transition:background .12s ease;

    white-space:nowrap;

}

.nav-link:hover{

    background:rgba(255,255,255,.16);

    color:#fff;

}

.nav-link--on{

    background:rgba(255,255,255,.24);

    color:#fff;

    font-weight:600;

}

.nav-meta{

    display:flex;

    align-items:center;

    gap:8px;

    color:rgba(255,255,255,.88);

    font-size:12.5px;

    white-space:nowrap;

    padding-left:12px;

}

.nav-dot{

    width:8px;

    height:8px;

    border-radius:50%;

    background:#9ff0b8;

    box-shadow:0 0 0 3px rgba(159,240,184,.22);

}

/* ---- page head ---- */

.header,
.header--slim{

    background:none;

    color:var(--ink);

    text-align:left;

    padding:26px 30px 4px;

}

.header .logo,
.header--slim .logo{

    display:none;

}

.header h1,
.header h2,
.header--slim h2{

    font-size:23px;

    font-weight:700;

    letter-spacing:-.2px;

    color:var(--ink);

    margin:0 0 5px;

}

.header p,
.header--slim p{

    margin:0;

    font-size:13.5px;

    color:var(--ink-dim);

    opacity:1;

}

.header .connection{

    display:none;

}

.content,
.content--left{

    padding:20px 30px 34px;

    text-align:left;

}

.content h2{

    font-size:17px;

    margin:26px 0 4px;

    color:var(--ink);

    letter-spacing:-.1px;

}

.content h2:first-child{

    margin-top:4px;

}

.subtitle{

    font-size:13.5px;

    color:var(--ink-dim);

    margin-bottom:18px;

    line-height:1.55;

    max-width:88ch;

}

.grid-hint{

    font-size:12.5px;

    color:var(--ink-dim);

    margin:10px 0 0;

}

.grid-note{

    font-size:12.5px;

    color:var(--ink-dim);

    margin-top:16px;

    line-height:1.6;

    max-width:96ch;

}

/* ---- customers page (/customers) ---- */

.cust-card{
    padding-bottom:14px;
}

.cust-form{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:10px;
    padding:14px 18px 0;
}

.cust-label{
    font-size:12px;
    text-transform:uppercase;
    letter-spacing:.05em;
    color:var(--ink-dim);
}

.cust-input{
    min-width:280px;
    padding:9px 12px;
    border:1px solid var(--line);
    border-radius:10px;
    font-size:14px;
}

.cust-suggest{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
}

.cust-suggest--empty{
    font-size:12.5px;
    color:var(--ink-dim);
}

.cust-check{
    display:flex;
    align-items:center;
    gap:6px;
    font-size:12.5px;
    color:var(--ink-dim);
    width:100%;
}

.cust-spelling{
    display:inline-block;
    margin:0 6px 4px 0;
    padding:2px 8px;
    border-radius:999px;
    background:#f2f7f3;
    font-size:12px;
}

.cust-pick{
    cursor:pointer;
}

/* ---- panels ---- */

.breakdown,
.po-card,
.excel-preview{

    border:1px solid var(--line);

    border-radius:var(--r-lg);

    background:var(--surface);

    box-shadow:var(--shadow-1);

    overflow:hidden;

}

.breakdown h3,
.breakdown h4{

    font-size:13px;

    text-transform:uppercase;

    letter-spacing:.06em;

    color:var(--ink-dim);

    padding:14px 18px 0;

    margin:0;

}

.po-card{

    border-left-width:1px;

    margin:14px 0;

}

.po-card--incoming,
.po-card--partial,
.po-card--received{

    border-left-width:1px;

}

.po-head{

    padding:15px 18px;

    background:var(--surface-2);

    border-bottom:1px solid var(--line-soft);

}

.po-title{

    font-size:16px;

    gap:11px;

}

.po-title strong{

    font-family:Consolas,"Cascadia Mono",monospace;

    font-size:15.5px;

    letter-spacing:-.2px;

}

.po-meta{

    font-size:12.5px;

    color:var(--ink-dim);

    gap:16px;

    margin-top:7px;

}

.tracking{

    background:var(--surface-3);

    border-radius:6px;

    padding:2px 8px;

}

/* ---- tables ---- */

.stock-table,
.breakdown table,
.result-table,
.entry-table{

    font-size:14px;

}

.stock-table th,
.breakdown th{

    background:var(--surface-2);

    font-size:11.5px;

    letter-spacing:.06em;

    color:var(--ink-dim);

    padding:11px 15px;

    border-bottom:1px solid var(--line);

    font-weight:700;

}

.stock-table td,
.breakdown td{

    padding:11px 15px;

    border-bottom:1px solid var(--line-soft);

}

.stock-table tbody tr:hover{

    background:var(--surface-2);

}

.mono,
.stock-table .mono,
.sub-mono{

    font-family:Consolas,"Cascadia Mono",monospace;

    font-size:12.5px;

}

.sub-mono{

    color:var(--ink-dim);

}

.num{

    font-variant-numeric:tabular-nums;

}

.action-cell{

    text-align:right;

}

/* ---- mini table inside an expanded row ---- */

.mini-table{

    font-size:13.5px;

}

.mini-table td{

    padding:9px 15px;

}

/* ---- buttons ---- */

.btn-import,
.btn-secondary,
.btn-mini,
.btn-back,
.template-link,
.btn-icon,
.btn-icon--ok{

    font-family:inherit;

    font-size:14px;

    border-radius:10px;

    padding:10px 17px;

    font-weight:600;

    text-decoration:none;

    display:inline-flex;

    align-items:center;

    justify-content:center;

    gap:7px;

    cursor:pointer;

    transition:background .12s ease,border-color .12s ease,box-shadow .12s ease;

    border:1px solid transparent;

}

.btn-import{

    background:linear-gradient(120deg,var(--brand),var(--brand-2));

    color:#fff;

    width:auto;

    box-shadow:var(--shadow-1);

}

.btn-import:hover{

    background:linear-gradient(120deg,#1f6b41,#358f4f);

}

/* The Import PO entry point, sitting inline in the Outbound toolbar rather
   than as a full-width form button. */
.btn-import--slim{

    width:auto;

    padding:9px 15px;

    font-size:13.5px;

    font-weight:600;

    border-radius:9px;

    text-decoration:none;

    white-space:nowrap;

    display:inline-flex;

    align-items:center;

    gap:6px;

}

.btn-secondary{

    background:var(--surface);

    border-color:var(--line);

    color:var(--ink-soft);

    padding:10px 15px;

}

.btn-secondary:hover{

    background:var(--surface-2);

    border-color:var(--brand-2);

    color:var(--brand-ink);

}

.btn-mini{

    padding:7px 13px;

    font-size:13px;

    background:var(--brand);

    border-color:var(--brand);

    color:#fff;

}

.btn-mini:hover{

    background:var(--brand-ink);

}

.btn-mini--ghost{

    background:var(--surface);

    border-color:var(--line);

    color:var(--ink-soft);

}

.btn-mini--ghost:hover{

    background:var(--surface-2);

    border-color:var(--brand-2);

    color:var(--brand-ink);

}

.btn-icon--ok{

    padding:7px 13px;

    font-size:13px;

}

/* ---- chips & pills ---- */

.chip,.tab{

    padding:7px 14px;

    font-size:13px;

    border-radius:999px;

    border:1px solid var(--line);

    color:var(--ink-soft);

    background:var(--surface);

    text-decoration:none;

    font-weight:500;

    white-space:nowrap;

}

.chip:hover,.tab:hover{

    border-color:var(--brand-2);

    background:var(--brand-tint);

    color:var(--brand-ink);

}

.chip--on,.tab--active{

    background:var(--brand);

    border-color:var(--brand);

    color:#fff;

}

.pill{

    font-size:11.5px;

    font-weight:700;

    letter-spacing:.03em;

    padding:4px 10px;

    border-radius:999px;

}

/* ---- form controls ---- */

input[type=text],
input[type=number],
input[type=date],
select{

    border:1px solid var(--line);

    border-radius:var(--r-sm);

    padding:10px 13px;

    font-size:14px;

    font-family:inherit;

    color:var(--ink);

    background:var(--surface);

}

input[type=text]:focus,
input[type=number]:focus,
input[type=date]:focus,
select:focus{

    outline:none;

    border-color:var(--brand-2);

    box-shadow:0 0 0 3px rgba(62,157,92,.15);

}

.bar-group input[type=text]{

    padding:10px 13px;

    font-size:14px;

}

.qty-input{

    padding:7px 9px;

    font-size:13.5px;

}

/* ---- status cards ---- */

.stat-grid{

    margin:6px 0 4px;

    gap:12px;

}

.stat{

    border-radius:var(--r-md);

    border:1px solid var(--line);

    border-left-width:1px;

    background:var(--surface-2);

    padding:15px 17px;

    box-shadow:var(--shadow-1);

}

.stat--incoming,
.stat--received,
.stat--bad{

    border-left-width:1px;

}

.stat--incoming{ background:var(--amber-tint); }

.stat--received{ background:var(--brand-tint); }

.stat--bad{ background:var(--red-tint); }

.stat-label{

    font-size:11.5px;

    color:var(--ink-dim);

    font-weight:700;

}

.stat-value{

    font-size:27px;

    color:var(--brand-ink);

}

.stat-note{

    font-size:12px;

}

/* ---- alerts ---- */

.alert{

    border-radius:var(--r-md);

    padding:14px 17px;

    margin:14px 0;

    font-size:13.5px;

    border:1px solid var(--line);

    border-left-width:4px;

    background:var(--surface-2);

}

.alert strong{

    font-size:13.5px;

    display:block;

    margin-bottom:4px;

}

.alert p{

    margin:0;

    line-height:1.6;

}

.alert--ok{ border-left-color:var(--brand); background:var(--brand-tint); }

.alert--warn{ border-left-color:var(--amber); background:var(--amber-tint); }

.alert--bad{ border-left-color:var(--red); background:var(--red-tint); }

/* ---- misc ---- */

.formula-bar,
.pager{

    gap:12px;

    margin:18px 0 6px;

}

.pager-info{

    font-size:13px;

    color:var(--ink-dim);

}

.footer{

    padding:18px 30px 26px;

    border-top:1px solid var(--line-soft);

    color:var(--ink-dim);

    font-size:12px;

    margin-top:26px;

}

.upload-box{

    border:2px dashed #b9d8c4;

    border-radius:var(--r-lg);

    padding:36px 24px;

    background:var(--surface-2);

}

.upload-box:hover,
.upload-box.dragging{

    border-color:var(--brand-2);

    background:var(--brand-tint);

}

.upload-title{

    font-size:16px;

}

.hint-bar{

    display:flex;

    gap:10px;

    flex-wrap:wrap;

    margin-top:18px;

}

.template-link{

    background:var(--surface-2);

    border:1px solid var(--line);

    color:var(--ink-soft);

    padding:10px 16px;

    border-radius:10px;

}

.template-link:hover{

    border-color:var(--brand-2);

    background:var(--brand-tint);

    color:var(--brand-ink);

}

@media(max-width:900px){

    .nav{

        padding:10px 16px;

    }

    .nav-meta{

        display:none;

    }

    .header,
    .content,
    .content--left{

        padding-left:18px;

        padding-right:18px;

    }

}


/* ==========================================
   ARRIVALS
========================================== */

.progress-cell{
    display:inline-flex;
    align-items:center;
    gap:8px;
    white-space:nowrap;
}

.meter{
    display:inline-block;
    width:88px;
    height:7px;
    border-radius:20px;
    background:#e6ece8;
    overflow:hidden;
    vertical-align:middle;
}

.meter-fill{
    display:block;
    height:100%;
    border-radius:20px;
    background:linear-gradient(90deg,var(--brand),var(--brand-2));
}

.meter-text{
    font-size:12px;
    color:var(--ink-soft);
    min-width:34px;
    text-align:right;
    font-variant-numeric:tabular-nums;
}

/* Amber until the work is finished, green only when it is. "Finished"
   means prepared AND inspected - the bar reaches 100% for nothing less,
   so a green bar always means Siap Kirim. */
.meter-fill--open{
    background:linear-gradient(90deg,#e0a63c,#f0c469);
}

.meter-fill--done{
    background:linear-gradient(90deg,var(--brand),var(--brand-2));
}

.meter-text--done{
    color:#2f7d49;
    font-weight:600;
}

/* Still working: the number is the prepared share, and amber keeps it
   distinct from the green "everything is QC passed" state. */
.meter-text--open{
    color:#a8742a;
    font-weight:600;
}

td .progress-cell{
    display:flex;
}

/* Sortable headers: the whole label is the click target, and the arrow
   shows which column is active and which way it runs. */
.th-sort{
    display:inline-flex;
    align-items:center;
    gap:4px;
    color:inherit;
    text-decoration:none;
    font:inherit;
    letter-spacing:inherit;
    text-transform:inherit;
}

.th-sort:hover{
    color:var(--brand);
}

.th-on .th-sort{
    color:var(--brand);
}

.th-sort .arrow{
    font-size:10px;
    line-height:1;
    opacity:.9;
}

/* On a narrow screen the filter chips scroll sideways instead of stacking
   into several rows and pushing the table off the screen. */
@media(max-width:760px){
    .chips{
        flex-wrap:nowrap;
        overflow-x:auto;
        padding-bottom:6px;
        -webkit-overflow-scrolling:touch;
    }

    .chips .chip{
        flex:0 0 auto;
    }
}

/* ==========================================
   INCOMING STOCKS: the three import cards
========================================== */

.import-grid{
    display:grid;
    grid-template-columns:repeat(3, minmax(0, 1fr));
    gap:14px;
    margin:4px 0 26px;
    align-items:stretch;
}

.import-card{
    display:flex;
    flex-direction:column;
    gap:9px;
    padding:16px 18px 18px;
    border:1px solid var(--line);
    border-radius:14px;
    background:var(--surface);
    box-shadow:0 1px 2px rgba(22,36,28,.04);
}

.import-card h3{
    margin:0 0 2px;
    font-size:15px;
    color:var(--ink);
}

.import-card .hint{
    margin:0;
    font-size:12px;
    color:var(--ink-dim);
}

.import-card input,
.import-card select{
    width:100%;
    box-sizing:border-box;
}

.import-card button{
    margin-top:auto;
    justify-content:center;
}

@media(max-width:960px){
    .import-grid{
        grid-template-columns:1fr;
    }
}

/* ==========================================
   INCOMING: list-first layout, imports in a dialog
========================================== */

.btn-primary{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:7px;
    padding:10px 18px;
    border:0;
    border-radius:11px;
    background:linear-gradient(180deg,var(--brand-2),var(--brand));
    color:#fff;
    font:inherit;
    font-size:14px;
    font-weight:650;
    cursor:pointer;
    box-shadow:0 2px 6px rgba(38,121,74,.28);
    transition:transform .12s ease, box-shadow .12s ease, filter .12s ease;
}

.btn-primary:hover{
    filter:brightness(1.05);
    box-shadow:0 4px 12px rgba(38,121,74,.34);
    transform:translateY(-1px);
}

.btn-primary:active{
    transform:translateY(0);
    box-shadow:0 1px 3px rgba(38,121,74,.3);
}

.btn-block{
    width:100%;
    margin-top:2px;
}

.btn-icon{
    font-size:15px;
    line-height:1;
}

.muted{
    color:var(--ink-dim);
}

.row-link{
    color:var(--brand-ink);
    font-weight:600;
    text-decoration:none;
    border-bottom:1px solid transparent;
}

.row-link:hover{
    border-bottom-color:var(--brand-2);
}

/* A wide table should scroll inside its own box rather than push the
   whole page sideways on a laptop or a tablet. */
.table-wrap{
    width:100%;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    border-radius:12px;
}

.table-wrap .stock-table{
    min-width:760px;
}

/* ---- dialog ---- */

.modal{
    width:min(880px, calc(100vw - 34px));
    max-height:min(86vh, 780px);
    padding:0;
    border:0;
    border-radius:18px;
    box-shadow:0 24px 60px rgba(16,32,24,.28);
    overflow:hidden;
}

/* Centred whether it is opened as a modal or merely rendered with the
   open attribute (the ?import=1 deep link). */
.modal[open]{
    position:fixed;
    inset:0;
    margin:auto;
    height:fit-content;
}

.modal::backdrop{
    background:rgba(16,32,24,.45);
    backdrop-filter:blur(2px);
}

.modal-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:16px 20px;
    border-bottom:1px solid var(--line);
    background:var(--surface-2);
}

.modal-head h3{
    margin:0;
    font-size:16px;
}

.icon-btn{
    width:32px;
    height:32px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border:1px solid var(--line);
    border-radius:9px;
    background:var(--surface);
    color:var(--ink-soft);
    cursor:pointer;
    font-size:13px;
}

.icon-btn:hover{
    background:var(--surface-3);
    color:var(--ink);
}

.modal-body{
    display:grid;
    grid-template-columns:repeat(2, minmax(0,1fr));
    gap:14px;
    padding:18px 20px 22px;
    overflow-y:auto;
    max-height:calc(86vh - 60px);
}

.import-block{
    display:flex;
    flex-direction:column;
    gap:8px;
    padding:14px 16px 16px;
    border:1px solid var(--line);
    border-radius:14px;
    background:var(--surface);
}

.import-head{
    display:flex;
    align-items:baseline;
    justify-content:space-between;
    gap:10px;
}

.import-head h4{
    margin:0;
    font-size:14px;
    color:var(--ink);
}

.import-block form{
    display:flex;
    flex-direction:column;
    gap:8px;
}

.import-block input{
    width:100%;
    box-sizing:border-box;
}

.import-block .hint{
    margin:0;
    font-size:12px;
    color:var(--ink-dim);
}

.hint-link{
    font-size:12px;
    color:var(--brand);
    text-decoration:none;
    white-space:nowrap;
}

.hint-link:hover{
    text-decoration:underline;
}

@media(max-width:860px){
    .modal-body{
        grid-template-columns:1fr;
    }

    .header--action{
        flex-wrap:wrap;
        gap:10px;
    }

    .header--action .btn-primary{
        width:100%;
    }
}

/* ---- PO detail: dashboard + CIPL cards ---- */

.kpi-row{
    display:grid;
    grid-template-columns:repeat(4, minmax(0,1fr));
    gap:12px;
    margin:2px 0 24px;
}

.kpi{
    display:flex;
    flex-direction:column;
    gap:4px;
    padding:14px 16px;
    border:1px solid var(--line);
    border-radius:14px;
    background:var(--surface);
}

.kpi-label{
    font-size:12px;
    color:var(--ink-dim);
    text-transform:uppercase;
    letter-spacing:.04em;
}

.kpi-value{
    font-size:24px;
    line-height:1.1;
    color:var(--ink);
}

.kpi--amber .kpi-value{ color:var(--amber); }
.kpi--green .kpi-value{ color:var(--brand); }

.kpi-meter{
    width:100%;
    margin-top:6px;
}

.cipl-grid{
    display:grid;
    grid-template-columns:repeat(auto-fill, minmax(300px, 1fr));
    gap:14px;
    margin-bottom:26px;
}

.cipl-card{
    display:flex;
    flex-direction:column;
    gap:8px;
    padding:14px 16px 16px;
    border:1px solid var(--line);
    border-radius:14px;
    background:var(--surface);
}

.cipl-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
}

.cipl-meta{
    margin:0;
    font-size:12.5px;
    color:var(--ink-soft);
}

.cipl-awb{
    display:flex;
    align-items:center;
    gap:8px;
    margin:0;
    font-size:13px;
}

.track-link{
    color:var(--brand);
    font-weight:650;
    text-decoration:none;
}

.track-link:hover{ text-decoration:underline; }

.awb-form{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
}

.awb-form select,
.awb-form input{ width:100%; box-sizing:border-box; }

.awb-form .btn-block{ grid-column:1 / -1; }

.empty-card{
    display:flex;
    flex-direction:column;
    align-items:flex-start;
    gap:10px;
    padding:18px 20px;
    margin-bottom:26px;
    border:1px dashed var(--line);
    border-radius:14px;
    background:var(--surface-2);
}

@media(max-width:820px){
    .kpi-row{ grid-template-columns:repeat(2, minmax(0,1fr)); }
    .awb-form{ grid-template-columns:1fr; }
}

/* CIPL import on a PO: a button that opens the file dialog, so it reads
   as an action rather than a bare file input. */
.cipl-import{
    display:flex;
    align-items:center;
    gap:12px;
    flex-wrap:wrap;
    margin:0 0 18px;
}

.cipl-import-label{
    display:inline-flex;
    align-items:center;
    gap:7px;
    padding:10px 18px;
    border-radius:11px;
    background:linear-gradient(180deg,var(--brand-2),var(--brand));
    color:#fff;
    font-size:14px;
    font-weight:650;
    cursor:pointer;
    box-shadow:0 2px 6px rgba(38,121,74,.28);
}

.cipl-import-label:hover{ filter:brightness(1.05); }

.cipl-import-label input{ display:none; }

.cipl-import .hint{
    font-size:12.5px;
    color:var(--ink-dim);
}

/* A filled AWB shows the link; editing is a deliberate act. */
.cipl-awb{
    flex-wrap:wrap;
}

.link-btn{
    cursor:pointer;
    font-size:12.5px;
    color:var(--brand);
    border:1px solid var(--line);
    border-radius:8px;
    padding:3px 10px;
    list-style:none;
}

.link-btn::-webkit-details-marker{ display:none; }

.link-btn:hover{ background:var(--surface-3); }

.awb-edit[open] .link-btn{ background:var(--surface-3); }

.awb-edit form{ margin-top:10px; }

.awb-edit{
    width:100%;
}

/* ==========================================
   OUTSTANDING: the chase list

   The page leads with a coverage donut and two ranked bar charts, then
   puts the full table behind a filter toolbar. The charts are plain CSS -
   a conic-gradient and a row of widths - so nothing has to be fetched
   from a CDN to draw them.
========================================== */

.out-head-meta{
    display:flex;
    align-items:center;
    gap:12px;
    flex-wrap:wrap;
}

.sync-note{
    font-size:12.5px;
    color:var(--ink-dim);
    white-space:nowrap;
}

.kpi-row--five{
    grid-template-columns:repeat(5,minmax(0,1fr));
}

.kpi-sub{
    font-size:11.5px;
    color:var(--ink-dim);
    line-height:1.35;
}

.kpi--red .kpi-value{ color:var(--red); }

/* ---- charts ---- */

.chart-grid{
    display:grid;
    grid-template-columns:minmax(250px,.9fr) minmax(290px,1.1fr) minmax(290px,1.1fr);
    gap:14px;
    margin:0 0 26px;
    align-items:stretch;
}

.chart-card{
    display:flex;
    flex-direction:column;
    gap:12px;
    min-width:0;
    padding:15px 17px 16px;
    border:1px solid var(--line);
    border-radius:14px;
    background:var(--surface);
    box-shadow:var(--shadow-1);
}

.chart-head{
    display:flex;
    align-items:baseline;
    justify-content:space-between;
    gap:10px;
}

.chart-head strong{
    font-size:13.5px;
    color:var(--ink);
}

.chart-sub{
    font-size:11.5px;
    color:var(--ink-dim);
    white-space:nowrap;
}

.donut-wrap{
    display:flex;
    align-items:center;
    gap:18px;
    flex-wrap:wrap;
    flex:1 1 auto;
    margin:auto 0;
}

.donut{
    position:relative;
    flex:0 0 auto;
    width:118px;
    height:118px;
    border-radius:50%;
    background:conic-gradient(
        var(--brand-2) calc(var(--p, 0) * 1%),
        #efd9ae 0
    );
}

.donut::after{
    content:"";
    position:absolute;
    inset:14px;
    border-radius:50%;
    background:var(--surface);
}

.donut-hole{
    position:absolute;
    inset:0;
    z-index:1;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:1px;
    text-align:center;
    line-height:1.1;
}

.donut-hole strong{
    font-size:23px;
    color:var(--brand-ink);
}

.donut-hole span{
    font-size:10px;
    letter-spacing:.05em;
    text-transform:uppercase;
    color:var(--ink-dim);
}

.legend{
    list-style:none;
    margin:0;
    padding:0;
    display:flex;
    flex-direction:column;
    gap:9px;
    flex:1 1 130px;
    font-size:12.5px;
    color:var(--ink-soft);
}

.legend li{
    display:flex;
    align-items:center;
    gap:7px;
    flex-wrap:wrap;
}

.legend b{
    color:var(--ink);
    font-variant-numeric:tabular-nums;
}

.legend-note{
    margin-left:auto;
    font-size:11.5px;
    color:var(--ink-dim);
}

.dot{
    display:inline-block;
    flex:0 0 auto;
    width:9px;
    height:9px;
    border-radius:50%;
    background:var(--brand-2);
    vertical-align:middle;
}

.dot--warn{ background:#dfaa54; }

.bars{
    list-style:none;
    margin:0;
    padding:0;
    display:flex;
    flex-direction:column;
    gap:9px;
}

/* Named .chart-bar on purpose: the outstanding page used plain ".bar"
   for these chart rows, which collided with the toolbar ".bar" used by
   the labels / tracking / arrivals pages and turned those toolbars into
   a 3-column grid. */
.chart-bar{
    display:grid;
    grid-template-columns:minmax(0,150px) minmax(0,1fr) 42px;
    align-items:center;
    gap:10px;
    font-size:12.5px;
}

.bar-label{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    color:var(--ink-soft);
}

.bar-label.mono{
    font-family:Consolas,"Cascadia Mono",monospace;
    font-size:11.5px;
    color:var(--ink);
}

.bar-track{
    height:9px;
    border-radius:999px;
    background:var(--surface-3);
    overflow:hidden;
}

.bar-fill{
    display:block;
    height:100%;
    min-width:2px;
    border-radius:999px;
    background:linear-gradient(90deg,var(--brand),var(--brand-2));
}

.bar-fill--warn{
    background:linear-gradient(90deg,#d99a2f,#e9bd72);
}

.bar-value{
    text-align:right;
    font-weight:650;
    color:var(--ink);
    font-variant-numeric:tabular-nums;
}

.chart-note{
    margin:auto 0 0;
    padding-top:4px;
    font-size:11.5px;
    color:var(--ink-dim);
    line-height:1.5;
}

/* ---- filter toolbar ---- */

.out-block-head{
    display:flex;
    align-items:baseline;
    justify-content:space-between;
    gap:12px;
    flex-wrap:wrap;
}

.out-block-head h3{
    margin:0;
    font-size:16px;
    color:var(--ink);
}

.out-hint{
    font-size:11.5px;
    color:var(--ink-dim);
}

.out-hint kbd{
    font-family:inherit;
    font-size:10.5px;
    padding:1px 6px;
    border:1px solid var(--line);
    border-bottom-width:2px;
    border-radius:5px;
    background:var(--surface-2);
    color:var(--ink-soft);
}

.out-toolbar{
    display:flex;
    align-items:center;
    gap:10px;
    flex-wrap:wrap;
    padding:12px 14px;
    margin:12px 0 10px;
    border:1px solid var(--line);
    border-radius:14px;
    background:var(--surface-2);
}

.out-search{
    position:relative;
    flex:1 1 280px;
    min-width:200px;
}

.out-search input[type=search]{
    width:100%;
    box-sizing:border-box;
    padding:10px 13px 10px 34px;
    border:1px solid var(--line);
    border-radius:var(--r-sm);
    background:var(--surface);
    color:var(--ink);
    font-family:inherit;
    font-size:14px;
    -webkit-appearance:none;
    appearance:none;
}

.out-search input[type=search]:focus{
    outline:none;
    border-color:var(--brand-2);
    box-shadow:0 0 0 3px rgba(62,157,92,.15);
}

.out-search-icon{
    position:absolute;
    left:12px;
    top:50%;
    display:flex;
    transform:translateY(-50%);
    color:var(--ink-dim);
    pointer-events:none;
}

.out-search-icon svg{
    display:block;
}

.out-toolbar select{
    flex:0 1 210px;
    max-width:100%;
}

.out-toolbar .btn-secondary{
    padding:10px 16px;
}

.out-count{
    margin:0 0 12px;
    font-size:12.5px;
    color:var(--ink-dim);
}

.out-count b{
    color:var(--ink);
    font-variant-numeric:tabular-nums;
}

.chip-count{
    margin-left:5px;
    opacity:.75;
    font-variant-numeric:tabular-nums;
}

/* ---- table ---- */

.table-wrap--tall{
    max-height:min(72vh,760px);
    overflow:auto;
    border:1px solid var(--line);
    background:var(--surface);
}

.table-wrap--tall .stock-table{
    min-width:880px;
}

.out-table thead th{
    position:sticky;
    top:0;
    z-index:2;
    background:var(--surface-2);
}

.out-table td{
    vertical-align:middle;
}

.out-customer{
    max-width:260px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.out-name{
    max-width:250px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    color:var(--ink-soft);
}

.out-qty{
    color:var(--amber);
    font-variant-numeric:tabular-nums;
}

.out-zero{
    color:#c2cfc7;
}

.pill--open{
    background:var(--red-tint);
    color:var(--red);
}

.out-empty{
    padding:26px 18px;
    margin-top:12px;
    text-align:center;
    font-size:13.5px;
    color:var(--ink-dim);
    border:1px dashed var(--line);
    border-radius:12px;
    background:var(--surface-2);
}

.out-empty[hidden]{
    display:none;
}

@media(max-width:1180px){

    .chart-grid{
        grid-template-columns:repeat(2,minmax(0,1fr));
    }

    .kpi-row--five{
        grid-template-columns:repeat(3,minmax(0,1fr));
    }

}

@media(max-width:820px){

    .chart-grid{
        grid-template-columns:1fr;
    }

    .kpi-row--five{
        grid-template-columns:repeat(2,minmax(0,1fr));
    }

    .out-toolbar select,
    .out-toolbar .out-search{
        flex:1 1 100%;
    }

    .out-toolbar .btn-secondary{
        flex:1 1 auto;
    }

}

/* Rows the current filter excludes. The server uses this for the no-JS
   case; with script running, display is set per row and this is moot. */
.out-table tr.is-hidden{
    display:none;
}

/* With script the filters apply as you type, so the submit button has
   nothing left to do. Without it, the button is the only way to filter. */
.out-toolbar.is-live button[type=submit]{
    display:none;
}


/* ==========================================
   PO DETAIL: one purchase, analysed

   Ordered vs shipped vs landed, the lines split by state, and the data
   gaps that make the numbers less trustworthy than they look.
========================================== */

.header h2 .pill{
    margin-left:9px;
    vertical-align:middle;
}

.quality-strip{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    margin:0 0 20px;
}

.quality-item{
    display:inline-flex;
    align-items:center;
    gap:8px;
    padding:8px 12px;
    border:1px solid #f0d9ae;
    border-radius:10px;
    background:var(--amber-tint);
    color:#7a5200;
    font-size:12.5px;
    font-weight:600;
}

.quality-icon{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:16px;
    height:16px;
    flex:0 0 auto;
    border-radius:50%;
    background:#dfaa54;
    color:#fff;
    font-size:10px;
    font-weight:800;
    line-height:1;
}

.quality-item--bad{
    border-color:#f0c6c0;
    background:var(--red-tint);
    color:#8c3a33;
}

.quality-item--bad .quality-icon{
    background:#c96e5f;
}

.bar-fill--bad{
    background:linear-gradient(90deg,#c96e5f,#d98b7d);
}

.eta-badge{
    display:inline-flex;
    align-items:center;
    gap:6px;
    margin:0;
    padding:3px 9px;
    border-radius:999px;
    background:var(--surface-3);
    color:var(--ink-soft);
    font-size:11.5px;
    font-weight:650;
    align-self:flex-start;
}

.eta-badge--lewat{
    background:var(--red-tint);
    color:var(--red);
}

.eta-badge--hari-ini{
    background:var(--amber-tint);
    color:var(--amber);
}

.eta-badge--akan{
    background:var(--brand-tint);
    color:var(--brand-ink);
}

.eta-badge--kosong{
    background:var(--surface-3);
    color:var(--ink-dim);
    font-weight:500;
}

.po-table{
    min-width:1080px;
}

.po-table .out-cipl{
    max-width:150px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.out-location{
    font-size:11.5px;
    color:var(--ink-soft);
    white-space:nowrap;
}

.cipl-card .progress-cell{
    margin:2px 0 4px;
}

.cipl-card .eta-badge{
    align-self:flex-start;
}

.cipl-card .cipl-awb{
    margin-top:2px;
}

/* A CIPL cell can hold several references; the card shows the first and
   how many more travel with it. */
.cipl-head .mono{
    font-size:12.5px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.cipl-extra{
    display:inline-block;
    margin-left:5px;
    padding:1px 6px;
    border-radius:999px;
    background:var(--surface-3);
    color:var(--ink-dim);
    font-size:10.5px;
    font-weight:700;
    vertical-align:middle;
    white-space:nowrap;
}


/* A recalled approval cannot become a PO: the button is present so the
   row keeps its shape, but it must not look clickable. */
.btn-mini:disabled{
    background:var(--surface-3);
    border-color:var(--line);
    color:var(--ink-dim);
    opacity:.85;
    cursor:not-allowed;
    box-shadow:none;
}

.btn-mini:disabled:hover{
    background:var(--surface-3);
    border-color:var(--line);
    color:var(--ink-dim);
}


/* Per-CIPL label printing: a print button on each shipment card, and the
   small confirm page it opens. Kept apart from the approval Label page so
   the two print flows cannot drift into each other. */
.cipl-actions{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    margin-top:auto;
    padding-top:2px;
}

.cipl-print-form{
    margin:0 0 18px;
    padding:14px 16px;
    border:1px solid var(--line);
    border-radius:14px;
    background:var(--surface-2);
}

.cipl-print-form .bar{
    margin:0;
}

.cipl-print-form .out-hint{
    margin:10px 0 0;
}


.label-total{
    font-size:13px;
    color:var(--ink-soft);
}

.label-total strong{
    color:var(--ink);
    font-variant-numeric:tabular-nums;
}


/* ==========================================
   OUTBOUND -> ONE PO

   The payment gate sits above everything: a PO may only move into WH
   Transaksi once PO Detail says PAID.
========================================== */

.payment-gate{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
    flex-wrap:wrap;
    margin:0 0 18px;
}

.payment-gate-text{
    flex:1 1 320px;
}

.payment-gate-form{
    display:flex;
    align-items:center;
    gap:8px;
    flex-wrap:wrap;
    margin:0;
}

.po-timeline{
    display:flex;
    flex-wrap:wrap;
    margin:0 0 26px;
    border:1px solid var(--line);
    border-radius:14px;
    background:var(--surface);
    box-shadow:var(--shadow-1);
    overflow:hidden;
}

.po-step{
    flex:1 1 150px;
    min-width:0;
    padding:12px 16px;
    border-right:1px solid var(--line-soft);
    display:flex;
    flex-direction:column;
    gap:2px;
}

.po-step:last-child{
    border-right:0;
}

.po-step-label{
    font-size:10.5px;
    letter-spacing:.05em;
    text-transform:uppercase;
    color:var(--ink-dim);
    font-weight:700;
}

.po-step-date{
    font-size:14px;
    font-weight:650;
    color:var(--ink);
    font-variant-numeric:tabular-nums;
}

.po-step--pending .po-step-date{
    color:var(--ink-dim);
    font-weight:500;
}

.po-step-note{
    font-size:11.5px;
    color:var(--ink-dim);
}

.sn-cell{
    min-width:70px;
}

.sn-more summary{
    cursor:pointer;
    font-size:12px;
    font-weight:650;
    color:var(--brand-ink);
    list-style:none;
    border:1px solid var(--line);
    border-radius:7px;
    padding:2px 8px;
    display:inline-block;
    white-space:nowrap;
}

.sn-more summary::-webkit-details-marker{
    display:none;
}

.sn-more[open] summary{
    background:var(--brand-tint);
    border-color:var(--brand-2);
}

.sn-list{
    display:flex;
    flex-direction:column;
    gap:2px;
    margin-top:6px;
    max-height:140px;
    overflow:auto;
    padding:6px 8px;
    border:1px solid var(--line);
    border-radius:8px;
    background:var(--surface-2);
    font-size:11px;
    min-width:150px;
}

.out-flag{
    font-size:11.5px;
    color:var(--ink-soft);
    max-width:150px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

/* DO and Payment were removed from this table, so the fixed width it
   needed is gone too. The remaining columns add up to roughly 1,000px of
   content; below that the wrapper scrolls, above it the table fills the
   space and the last column absorbs the slack. */
.outbound-po-table{
    min-width:1000px;
}

/* The alert style makes every <strong> a block; inside the payment gate
   the labels must stay in the sentence. */
.payment-gate p strong{
    display:inline;
    font-size:inherit;
    margin:0;
}


/* Payment status lives in the header as one compact control, not a
   full-width alert: it is a status, not a page section. */
.payment-inline-form{
    display:flex;
    align-items:center;
    gap:6px;
    margin:0;
}

.payment-inline-label{
    font-size:11.5px;
    font-weight:600;
    color:var(--ink-dim);
}

.payment-inline-form select{
    padding:7px 10px;
    font-size:13px;
}

.payment-inline-form .btn-mini{
    padding:7px 11px;
}

.payment-block{
    margin:8px 0 0;
    font-size:12.5px;
    font-weight:600;
    color:var(--amber);
}


/* KPI provenance: a small "i" opens a popup that lists the rows behind
   the number, so a figure can be traced back to its table and field. */
.kpi{
    position:relative;
}

.kpi-info{
    position:absolute;
    top:9px;
    right:9px;
    width:18px;
    height:18px;
    padding:0;
    border:1px solid var(--line);
    border-radius:50%;
    background:var(--surface);
    color:var(--ink-dim);
    font-size:11px;
    font-weight:700;
    line-height:1;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
}

.kpi-info:hover{
    border-color:var(--brand-2);
    background:var(--brand-tint);
    color:var(--brand-ink);
}

.explain-dialog{
    width:min(760px, calc(100vw - 34px));
}

.explain-body{
    display:block;
    padding:18px 20px;
    overflow:auto;
    max-height:70vh;
}

.explain-panel[hidden]{
    display:none;
}

.explain-line{
    margin:0 0 8px;
    font-size:13px;
    color:var(--ink-soft);
    line-height:1.5;
}

.explain-line .kpi-label{
    display:block;
    margin-bottom:1px;
}

.explain-table-wrap{
    margin:12px 0;
    border:1px solid var(--line);
    border-radius:10px;
    max-height:320px;
    overflow:auto;
}

.explain-table-wrap table{
    width:100%;
    border-collapse:collapse;
}

.explain-table-wrap thead th{
    position:sticky;
    top:0;
    z-index:1;
    background:var(--surface-2);
}

.explain-table-wrap tfoot td{
    position:sticky;
    bottom:0;
    background:var(--surface-2);
}


/* Prepare/QC stages per material: the date plus how far that stage got.
   Outstanding lines are the ones that need the badge, not a paragraph. */
.stage-cell{
    min-width:140px;
    vertical-align:top;
}

.stage-date{
    font-size:12.5px;
    font-weight:650;
    color:var(--ink);
    font-variant-numeric:tabular-nums;
}

.stage-sub{
    margin-left:4px;
    font-size:11px;
    color:var(--ink-dim);
    font-variant-numeric:tabular-nums;
}

.stage-badge{
    display:inline-block;
    margin-top:3px;
    padding:1px 7px;
    border-radius:999px;
    background:var(--surface-3);
    color:var(--ink-dim);
    font-size:10.5px;
    font-weight:700;
    white-space:nowrap;
}

.stage-badge--full,
.stage-badge--passed{
    background:var(--brand-tint);
    color:var(--brand-ink);
}

.stage-badge--part,
.stage-badge--warn,
.stage-badge--pending{
    background:var(--amber-tint);
    color:var(--amber);
}

.stage-badge--indent,
.stage-badge--bad{
    background:var(--red-tint);
    color:var(--red);
}

.wh-more{
    margin-top:4px;
}

.wh-more summary{
    cursor:pointer;
    font-size:10.5px;
    font-weight:600;
    color:var(--brand);
    list-style:none;
}

.wh-more summary::-webkit-details-marker{
    display:none;
}

.wh-history{
    display:flex;
    flex-direction:column;
    gap:3px;
    margin-top:4px;
    padding:6px 8px;
    border:1px solid var(--line);
    border-radius:8px;
    background:var(--surface-2);
}

.wh-event{
    display:flex;
    gap:8px;
    font-size:10.5px;
    color:var(--ink-soft);
    white-space:nowrap;
}


/* Stage badges own their line so date / qty / status never run together. */
.stage-cell{
    min-width:112px;
    white-space:normal;
}

.stage-badge{
    display:block;
    width:fit-content;
}

/* DO and Payment were removed from this table, so the fixed width it
   needed is gone too. The remaining columns add up to roughly 1,000px of
   content; below that the wrapper scrolls, above it the table fills the
   space and the last column absorbs the slack. */
.outbound-po-table{
    min-width:1000px;
}


/* Optional grouping: one table per group, each with its own scroll and
   sticky header, so one long sheet does not swallow the whole page. */
.group-block{
    margin:0 0 18px;
}

.group-title{
    display:flex;
    align-items:center;
    gap:8px;
    margin:0 0 8px;
    font-size:11.5px;
    font-weight:700;
    letter-spacing:.05em;
    text-transform:uppercase;
    color:var(--ink-soft);
}

.group-count{
    font-weight:600;
    letter-spacing:0;
    text-transform:none;
    color:var(--ink-dim);
}

.group-table{
    max-height:min(60vh, 640px);
    overflow:auto;
    border:1px solid var(--line);
    background:var(--surface);
}

/* The grouped view renders the same columns, so it takes the same width. */
.group-table .stock-table{
    min-width:1000px;
}


.stage-cell{
    min-width:130px;
}

.stage-date{
    white-space:nowrap;
}


/* ---- Sparepart keluar (report) ---------------------------------- */

.sp-table .sp-customer{
    max-width:220px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.sp-table .sp-name{
    max-width:280px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    color:var(--ink-soft);
}

.sp-qc{
    font-size:11.5px;
    color:var(--ink-dim);
}

.sp-qc--ok{ color:var(--brand); }

.sp-qc--warn{ color:var(--amber); }

.sp-pager{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:14px;
    margin:14px 0 4px;
    flex-wrap:wrap;
}

.sp-pager-note{
    font-size:12.5px;
    color:var(--ink-dim);
}

.sp-note{
    max-width:920px;
    margin:16px 0 0;
    font-size:11.5px;
    line-height:1.65;
    color:var(--ink-dim);
}

.sp-note b{ color:var(--ink-soft); }

/* Sparepart: four cards read better as a balanced 2 x 2 grid than as
   a 3 + 1 row with an empty cell. */
.chart-grid--two{
    grid-template-columns:repeat(2,minmax(0,1fr));
}

@media (max-width:900px){
    .chart-grid--two{ grid-template-columns:1fr; }
}


/* ==========================================
   PO DETAIL -> QC SPAREPART

   QC is recorded in WH Transaksi, one row per prepared lot. This page
   shows the verdict and collects a selection; the write happens on
   submit, after the confirm dialog. Colours follow the same ok / warn /
   pending language as the rest of the app.
========================================= */

/* ---- chips: QC is a second axis, so it sits after a rule ---- */

.chip--qc{
    border-style:dashed;
}

.chip--qc.chip--on{
    border-style:solid;
}

/* ---- pick column ---- */

.outbound-po-table th.pick,
.outbound-po-table td.pick{
    width:38px;
    min-width:38px;
    padding-left:10px;
    padding-right:4px;
    text-align:center;
}

.outbound-po-table input.qc-check{
    width:16px;
    height:16px;
    margin:0;
    cursor:pointer;
    accent-color:var(--brand);
}

.outbound-po-table input.qc-check:disabled{
    cursor:not-allowed;
    opacity:.35;
}

/* A selected row reads as "going to be written". */
.outbound-po-table tr.qc-on td{
    background:var(--brand-tint);
}

.qc-meta{
    display:block;
    margin-top:3px;
    font-size:11px;
    color:var(--ink-dim);
    font-variant-numeric:tabular-nums;
}

/* ---- bulk action bar ---- */

.qc-bar{
    display:flex;
    align-items:center;
    gap:10px;
    flex-wrap:wrap;
    padding:10px 14px;
    margin:0 0 12px;
    border:1px solid var(--line);
    border-radius:14px;
    background:var(--surface-2);
}

.qc-pick{
    display:flex;
    align-items:center;
    gap:10px;
    padding-right:12px;
    border-right:1px solid var(--line);
    font-size:13px;
    color:var(--ink-soft);
}

.qc-pick[hidden]{
    display:none;
}

.qc-pick-count b{
    color:var(--ink);
    font-variant-numeric:tabular-nums;
}

.qc-link{
    border:0;
    padding:0;
    background:none;
    color:var(--brand);
    font-family:inherit;
    font-size:12.5px;
    cursor:pointer;
    text-decoration:underline;
}

.qc-actions{
    display:flex;
    align-items:center;
    gap:8px;
    flex-wrap:wrap;
}

.qc-pass{
    display:inline-flex;
    align-items:center;
    gap:6px;
}

.qc-pass:disabled{
    opacity:.5;
    cursor:not-allowed;
}

.qc-hint{
    margin-left:auto;
    font-size:12px;
    color:var(--ink-dim);
}

/* ---- confirm dialog ---- */

.qc-dialog{
    width:min(520px, calc(100vw - 34px));
}

.qc-dialog-body{
    display:block;
    padding:18px 20px 8px;
}

.qc-dialog-text{
    margin:0 0 6px;
    font-size:14px;
    color:var(--ink);
}

.qc-dialog-text b{
    font-variant-numeric:tabular-nums;
}

.qc-dialog-note{
    margin:0 0 12px;
    font-size:12px;
    color:var(--ink-dim);
}

.qc-dialog-list{
    display:grid;
    gap:4px;
    max-height:220px;
    overflow:auto;
    margin:0;
    padding:10px 12px;
    border:1px solid var(--line);
    border-radius:10px;
    background:var(--surface-2);
    list-style:none;
    font-size:12.5px;
}

.qc-dialog-list li{
    display:flex;
    gap:8px;
    align-items:baseline;
}

.qc-dialog-list b{
    font-family:ui-monospace, SFMono-Regular, Menlo, monospace;
    font-weight:600;
    white-space:nowrap;
}

.qc-dialog-list span{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    color:var(--ink-soft);
}

.qc-dialog-more{
    color:var(--ink-dim);
}

.qc-dialog-foot{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:10px;
    padding:14px 20px 18px;
    border-top:1px solid var(--line);
}

@media (max-width:720px){
    .qc-hint{ margin-left:0; flex:1 1 100%; }
}

/* ==========================================
   PO DETAIL v2

   The five KPI cards and the "Alur qty" bars repeated each other, and the
   status donut usually drew a single ring. They are replaced by one
   segmented bar; the freed card shows what to chase next (ETAs).
========================================== */

/* ---- one segmented flow bar instead of five cards ---- */

.flow-card{
    display:flex;
    flex-direction:column;
    gap:12px;
    margin:0 0 20px;
    padding:16px 18px 17px;
    border:1px solid var(--line);
    border-radius:14px;
    background:var(--surface);
    box-shadow:var(--shadow-1);
}

.flow-head{
    display:flex;
    align-items:baseline;
    justify-content:space-between;
    gap:12px;
    flex-wrap:wrap;
}

.flow-headline{
    display:flex;
    align-items:baseline;
    gap:9px;
    flex-wrap:wrap;
    font-size:13px;
    color:var(--ink-soft);
}

.flow-headline strong{
    font-size:26px;
    line-height:1;
    color:var(--brand-ink);
    font-variant-numeric:tabular-nums;
}

.flow-total{
    font-size:12px;
    font-weight:650;
    color:var(--ink-soft);
    white-space:nowrap;
}

.flow-bar{
    display:flex;
    gap:3px;
    height:14px;
    border-radius:999px;
    overflow:hidden;
    background:var(--surface-3);
}

/* Sizing is left to the page: the incoming detail sets `flex-grow` and
   this rule used to force an equal share on top of it, which also
   overrode the explicit `width` the Outbound bar sets per segment. Only
   the segments that ask for flex get it. */
.flow-seg{
    display:block;
    min-width:0;
    border-radius:2px;
    /* An explicit width wins; a segment with 0% takes no space at all. */
    flex:0 0 auto;
}

/* The incoming detail's segments are flex-sized rather than given a
   width, so they grow in proportion to their share. */
.flow-seg--arrived,
.flow-seg--transit,
.flow-seg--unshipped{
    flex:1 1 0;
    min-width:0;
}

.flow-seg--arrived{
    background:linear-gradient(180deg,var(--brand-2),var(--brand));
}

.flow-seg--transit{
    background:linear-gradient(180deg,#e9bd72,#d99a2f);
}

.flow-seg--unshipped{
    background:#dfe7e2;
}

.flow-legend{
    list-style:none;
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:10px 16px;
    margin:0;
    padding:0;
    font-size:12.5px;
    color:var(--ink-soft);
}

.flow-legend li{
    display:flex;
    align-items:center;
    gap:6px;
    flex-wrap:wrap;
    min-width:0;
}

.flow-legend b{
    color:var(--ink);
    font-variant-numeric:tabular-nums;
}

.flow-qty{
    font-weight:650;
    color:var(--ink-soft);
    font-variant-numeric:tabular-nums;
}

.flow-note{
    flex:1 1 100%;
    padding-left:15px;
    font-size:11px;
    color:var(--ink-dim);
}

.dot--arrived{ background:var(--brand-2); }
.dot--transit{ background:#d99a2f; }
.dot--unshipped{ background:#c3d1c8; }

/* ---- two charts, not three ---- */

.chart-grid--two{
    grid-template-columns:repeat(2,minmax(0,1fr));
}

.chart-bar--stacked{
    align-items:start;
}

.chart-bar--stacked .bar-track,
.chart-bar--stacked .bar-value{
    margin-top:3px;
}

.bar-text{
    display:flex;
    flex-direction:column;
    gap:1px;
    min-width:0;
}

.bar-sub{
    font-size:11px;
    color:var(--ink-dim);
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

/* ---- ETA buckets ---- */

.eta-list{
    list-style:none;
    display:flex;
    flex-direction:column;
    gap:7px;
    margin:0;
    padding:0;
}

.eta-row{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    align-items:center;
    gap:2px 12px;
    padding:8px 11px;
    border:1px solid var(--line-soft);
    border-left:3px solid var(--line);
    border-radius:10px;
    background:var(--surface-2);
}

.eta-row--lewat{ border-left-color:#c96e5f; background:var(--red-tint); }
.eta-row--hari-ini{ border-left-color:#d99a2f; background:var(--amber-tint); }
.eta-row--minggu-ini{ border-left-color:#dfaa54; }
.eta-row--bulan-ini{ border-left-color:var(--brand-2); }
.eta-row--akan{ border-left-color:var(--brand-2); }
.eta-row--kosong{ border-left-style:dashed; }

.eta-when{
    display:flex;
    align-items:baseline;
    gap:6px;
    flex-wrap:wrap;
    font-size:12.5px;
}

.eta-when strong{ color:var(--ink); }

.eta-note{
    font-size:11px;
    color:var(--red);
    font-weight:650;
}

.eta-row--kosong .eta-note{ color:var(--ink-dim); font-weight:500; }

.eta-what{
    grid-column:1;
    font-size:11.5px;
    color:var(--ink-dim);
}

.eta-chips{
    grid-column:2;
    grid-row:1 / span 2;
    display:flex;
    align-items:center;
    gap:4px;
    flex-wrap:wrap;
    justify-content:flex-end;
}

.eta-more{
    font-size:11px;
    color:var(--ink-dim);
}

/* ---- CIPL badges (table + ETA card) ---- */

.cipl-badge{
    display:inline-flex;
    align-items:center;
    gap:4px;
    padding:2px 8px;
    border:1px solid var(--line);
    border-radius:999px;
    background:var(--surface);
    color:var(--brand-ink);
    font-family:Consolas,"Cascadia Mono",monospace;
    font-size:11px;
    font-weight:650;
    line-height:1.5;
    cursor:pointer;
    white-space:nowrap;
    max-width:100%;
    overflow:hidden;
    text-overflow:ellipsis;
}

.cipl-badge:hover{
    border-color:var(--brand-2);
    background:var(--brand-tint);
}

.cipl-badge:focus-visible{
    outline:2px solid var(--brand-2);
    outline-offset:1px;
}

.cipl-badge-extra{
    padding:0 5px;
    border-radius:999px;
    background:var(--surface-3);
    color:var(--ink-dim);
    font-size:10px;
    font-weight:750;
}

.cipl-missing{
    font-size:11px;
    font-weight:650;
    color:var(--red);
    white-space:nowrap;
}

.po-table .out-cipl{
    max-width:190px;
}

/* ---- chips: the two operational filters ---- */

.chip--alert{
    border-color:#f0c6c0;
    color:#8c3a33;
    background:var(--red-tint);
}

.chip--alert:hover{
    border-color:#c96e5f;
    background:var(--red-tint);
    color:#8c3a33;
}

.chip--warn{
    border-color:#f0d9ae;
    color:#7a5200;
    background:var(--amber-tint);
}

.chip--warn:hover{
    border-color:#d99a2f;
    background:var(--amber-tint);
    color:#7a5200;
}

.chip--alert.chip--on,
.chip--warn.chip--on{
    color:#fff;
}

.chip--alert.chip--on{ background:#b3261e; border-color:#b3261e; }
.chip--warn.chip--on{ background:#b07300; border-color:#b07300; }

/* ---- section header with its action on the right ---- */

.out-block-head--action{
    align-items:center;
    margin-bottom:10px;
}

.out-block-head--action h3{
    margin:0;
}

.out-block-tools{
    display:flex;
    align-items:center;
    gap:12px;
    flex-wrap:wrap;
    margin-left:auto;
}

.out-block-tools .cipl-import{
    margin:0;
}

.out-search--compact{
    flex:0 1 300px;
    min-width:200px;
}

.out-search--compact input[type=search]{
    padding-top:8px;
    padding-bottom:8px;
    font-size:13px;
}

/* The pills are buttons now: they can jump to the rows they describe. */
button.quality-item{
    font:inherit;
    cursor:default;
}

.quality-item[data-quick]{
    cursor:pointer;
}

.quality-item[data-quick]:hover{
    filter:brightness(.97);
    border-color:#d99a2f;
}

.quality-item--bad[data-quick]:hover{
    border-color:#c96e5f;
}

/* ---- CIPL card: action row and edit panel ---- */

.cipl-card{
    scroll-margin:90px;
}

.cipl-card--hit{
    animation:cipl-hit 1.6s ease-out;
}

@keyframes cipl-hit{
    0%   { border-color:var(--brand-2); box-shadow:0 0 0 4px rgba(62,157,92,.30); }
    60%  { border-color:var(--brand-2); box-shadow:0 0 0 3px rgba(62,157,92,.16); }
    100% { border-color:var(--line); box-shadow:none; }
}

.cipl-card:focus-visible{
    outline:none;
}

.cipl-edit-panel{
    margin:2px 0 0;
}

.cipl-actions{
    padding-top:10px;
    border-top:1px solid var(--line-soft);
}

.cipl-actions .btn-mini{
    display:inline-flex;
    align-items:center;
    gap:5px;
}

@media(max-width:1180px){
    .chart-grid--two{
        grid-template-columns:1fr;
    }
}

@media(max-width:820px){
    .flow-legend{
        grid-template-columns:1fr;
    }

    .out-block-head--action{
        align-items:flex-start;
    }

    .out-block-tools{
        margin-left:0;
        width:100%;
    }

    .out-search--compact{
        flex:1 1 100%;
    }
}

@media (prefers-reduced-motion: reduce){
    .cipl-card--hit{ animation:none; }
}

/* ==========================================
   PO DETAIL v2 - Shipment card polish
========================================== */

/* Completed shipment card: muted border, no ETA noise */
.cipl-card--complete{
    border-color:var(--line-soft);
    background:var(--surface-2);
}

.cipl-card--complete .cipl-head .mono{
    color:var(--ink-dim);
}

.cipl-card--complete .pill{
    opacity:.7;
}

/* Completed badge - green, prominent */
.eta-badge--complete{
    display:inline-flex;
    align-items:center;
    gap:5px;
    padding:5px 11px;
    border-radius:999px;
    background:var(--brand-tint);
    color:var(--brand-ink);
    font-size:11.5px;
    font-weight:650;
    border:1px solid var(--brand-2);
}

/* "isi ETA" link-button on incomplete shipments */
.eta-fill-link{
    display:inline-flex;
    align-items:center;
    gap:4px;
    padding:3px 9px;
    border:1px dashed var(--brand-2);
    border-radius:999px;
    background:transparent;
    color:var(--brand);
    font-size:11.5px;
    font-weight:600;
    cursor:pointer;
    text-decoration:none;
    white-space:nowrap;
}

.eta-fill-link:hover{
    background:var(--brand-tint);
    border-style:solid;
}

/* Meta line: concise, never wraps */
.cipl-meta{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:6px;
    margin:0;
    font-size:12px;
    color:var(--ink-soft);
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

/* Ensure all cards have same meta height */
.cipl-card .cipl-meta{
    min-height:20px;
}

/* ---- merged toolbar row (search + sort + reset) ---- */
.out-toolbar{
    padding:10px 12px;
    margin:8px 0 10px;
}

/* One row on desktop; the inputs share a fixed 40px height so the search
   field, both selects and the Reset button line up exactly.

   `flex-wrap` (not `nowrap`) and `min-width:0` are what stop the row
   overflowing the viewport: the search field alone asks for 180px and the
   select for 150px, so with the 220px sidebar expanded the row could not
   fit and was clipped off the right edge. Now it wraps the controls onto
   a second line instead. */
.out-toolbar-row{
    display:flex;
    align-items:center;
    gap:10px;
    flex-wrap:wrap;
    min-width:0;
}

.out-toolbar-row .out-search{
    flex:1 1 auto;
    min-width:180px;
    max-width:100%;
}

.out-search--inline{
    flex:1 1 auto;
    min-width:180px;
    max-width:100%;
}

.out-search--inline input[type=search]{
    height:40px;
    padding:0 12px 0 32px;
    border:1px solid var(--line);
    border-radius:var(--r-sm);
    background:var(--surface);
    color:var(--ink);
    font-family:inherit;
    font-size:13px;
    width:100%;
    box-sizing:border-box;
    -webkit-appearance:none;
    appearance:none;
}

.out-search--inline .out-search-icon{
    left:10px;
}

.out-toolbar select{
    flex:0 1 auto;
    height:40px;
    min-width:150px;
    max-width:220px;
    padding:0 36px 0 12px;
    border:1px solid var(--line);
    border-radius:var(--r-sm);
    background:var(--surface);
    color:var(--ink);
    font-family:inherit;
    font-size:13px;
    -webkit-appearance:none;
    appearance:none;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234b6156' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat:no-repeat;
    background-position:right 10px center;
}

.out-toolbar .btn-mini{
    flex:0 0 auto;
    height:40px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:0 16px;
    font-size:13px;
    white-space:nowrap;
}

@media(max-width:820px){
    .out-toolbar-row{
        flex-wrap:wrap;
    }

    .out-toolbar-row .out-search,
    .out-search--inline{
        flex:1 1 100%;
    }

    .out-toolbar select{
        flex:1 1 100%;
        max-width:none;
    }

    .out-toolbar .btn-mini{
        flex:1 1 100%;
    }
}

/* ==========================================
   OUTBOUND PO DETAIL - stage bar, summaries,
   timeline states and the single-row toolbar
========================================== */

/* ---- stage segments: shares of ordered qty ---- */
.flow-bar{
    display:flex;
    width:100%;
    height:14px;
    border-radius:999px;
    overflow:hidden;
    background:var(--line-soft);
}

.flow-seg{
    display:block;
    height:100%;
    min-width:0;
}

.flow-seg--ready{ background:#3e9d5c; }
.flow-seg--qc{ background:#dfaa54; }
.flow-seg--waiting{ background:#c9d4cd; }

.flow-legend--ready .dot{ background:#3e9d5c; }
.flow-legend--qc .dot{ background:#dfaa54; }
.flow-legend--waiting .dot{ background:#c9d4cd; }

/* ---- KPI strip inside the progress card ---- */
.flow-kpis{
    display:grid;
    grid-template-columns:repeat(5, minmax(0, 1fr));
    gap:10px;
    margin:14px 0 0;
    padding:12px 0 0;
    border-top:1px solid var(--line-soft);
}

.flow-kpi{
    display:flex;
    flex-direction:column;
    gap:2px;
    min-width:0;
}

.flow-kpi dt{
    margin:0;
    font-size:10.5px;
    font-weight:600;
    letter-spacing:.04em;
    text-transform:uppercase;
    color:var(--ink-dim);
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.flow-kpi dd{
    margin:0;
    font-size:19px;
    font-weight:700;
    line-height:1.15;
    color:var(--ink);
    font-variant-numeric:tabular-nums;
}

.flow-kpi--ready dd{ color:#2f7d49; }
.flow-kpi--short dd{ color:#b8564a; }

/* ---- QC & SN summary card ---- */
.qc-summary{
    list-style:none;
    margin:0 0 12px;
    padding:0;
    display:flex;
    flex-direction:column;
    gap:8px;
}

.qc-summary-row{
    display:grid;
    grid-template-columns:1fr auto auto;
    align-items:baseline;
    gap:10px;
    padding:7px 10px;
    border:1px solid var(--line-soft);
    border-radius:8px;
    background:var(--surface-2);
}

.qc-summary-label{
    display:flex;
    align-items:center;
    gap:7px;
    font-size:12px;
    color:var(--ink-soft);
}

.qc-summary-label .dot{
    width:8px;
    height:8px;
    border-radius:50%;
    display:inline-block;
    background:var(--line);
}

.qc-summary-row--passed .qc-summary-label .dot{ background:#3e9d5c; }
.qc-summary-row--waiting .qc-summary-label .dot{ background:#dfaa54; }
.qc-summary-row--sn .qc-summary-label .dot{ display:none; }

.qc-summary-qty{
    font-size:14px;
    font-variant-numeric:tabular-nums;
    color:var(--ink);
}

.qc-summary-of{
    font-weight:500;
    color:var(--ink-dim);
}

.qc-summary-meta{
    font-size:11px;
    color:var(--ink-dim);
    white-space:nowrap;
}

.qc-summary-meter{ margin:0; }

/* ---- Outstanding / short-stock card ---- */
.short-list{
    list-style:none;
    margin:0 0 10px;
    padding:0;
    display:flex;
    flex-direction:column;
    gap:7px;
}

.short-row{
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(60px,38%) auto;
    align-items:center;
    gap:10px;
    font-size:12px;
}

.short-name{
    display:flex;
    flex-direction:column;
    min-width:0;
}

.short-code{
    font-size:11.5px;
    color:var(--ink);
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.short-sub{
    font-size:10.5px;
    color:var(--ink-dim);
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.short-track{ min-width:0; }

.short-qty{
    font-weight:700;
    font-variant-numeric:tabular-nums;
    color:#b8564a;
    text-align:right;
    min-width:38px;
}

.chart-note--ok{
    color:#2f7d49;
    font-weight:600;
}

/* ---- 5-step timeline states ---- */
.po-timeline{
    align-items:stretch;
}

.po-step{
    position:relative;
    display:flex;
    flex-direction:column;
    gap:3px;
    padding-top:26px;
}

.po-step-dot{
    position:absolute;
    top:0;
    left:0;
    display:flex;
    align-items:center;
    justify-content:center;
    width:18px;
    height:18px;
    border-radius:50%;
    font-size:10px;
    font-weight:700;
    line-height:1;
    border:2px solid var(--line);
    background:var(--surface);
    color:var(--ink-dim);
}

.po-step--done .po-step-dot{
    border-color:#3e9d5c;
    background:#3e9d5c;
    color:#fff;
}

.po-step--done .po-step-label{ color:var(--ink); }

.po-step--active .po-step-dot{
    border-color:#dfaa54;
    background:var(--surface);
    color:#a8742a;
    box-shadow:0 0 0 3px rgba(223,170,84,.22);
}

.po-step--active .po-step-label{
    color:#a8742a;
    font-weight:700;
}

.po-step--pending{ opacity:.62; }

.po-step--pending .po-step-date{ color:var(--ink-dim); }

@media(max-width:1180px){
    .flow-kpis{
        grid-template-columns:repeat(3, minmax(0, 1fr));
    }
}

@media(max-width:820px){
    .flow-kpis{
        grid-template-columns:repeat(2, minmax(0, 1fr));
    }

    .qc-summary-row{
        grid-template-columns:1fr auto;
    }

    .qc-summary-meta{
        grid-column:1 / -1;
    }
}

/* Small "i" provenance button inside the KPI strip */
.flow-kpi dt{
    display:flex;
    align-items:center;
    gap:5px;
}

.flow-kpi dt .kpi-info{
    width:14px;
    height:14px;
    font-size:9px;
    line-height:1;
    padding:0;
    border-radius:50%;
    flex:0 0 auto;
}

/* ==========================================
   OUTBOUND PO DETAIL - card overflow + INDENT
========================================== */

/* The summary cards sit in a grid row that stretches to the tallest card.
   The QC & SN card used to clip its last row (the SN line); let it grow
   and keep real padding under the meter instead. */
.chart-grid--two{
    align-items:start;
}

.chart-grid--two > .chart-card{
    height:auto;
    max-height:none;
    min-height:0;
    overflow:visible;
    padding-bottom:18px;
}

.chart-grid--two > .chart-card > .qc-summary{
    flex:0 0 auto;
}

.chart-grid--two > .chart-card > .qc-summary-meter{
    margin:0 0 4px;
}

/* INDENT badge next to an outstanding quantity */
.out-indent,
.short-indent{
    display:inline-block;
    margin-left:6px;
    padding:1px 6px;
    font-size:10px;
    font-weight:700;
    letter-spacing:.03em;
    vertical-align:middle;
}

/* Table cell: number and badge share one line without wrapping the qty */
.out-outstanding{
    white-space:nowrap;
}

/* Short-stock rows now carry a qty label and an optional badge, so the
   quantity column has to be wide enough for both. */
.short-row{
    grid-template-columns:minmax(0,1fr) minmax(48px,32%) auto auto;
}

.short-qty{
    white-space:nowrap;
    min-width:auto;
}

/* ==========================================
   APPROVAL + OUTBOUND (split pages)
========================================== */

/* ---- bulk import bar on the Approval page ---- */
.bulk-bar{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:12px;
    margin:0 0 10px;
}

.bulk-count{
    font-size:12px;
    color:var(--ink-dim);
}

.bulk-count b{
    color:var(--ink);
    font-variant-numeric:tabular-nums;
}

.approval-table .pick{
    width:36px;
}

/* ---- KPI cards that filter the table ---- */
.out-kpi{
    display:grid;
    grid-template-columns:repeat(4, minmax(0, 1fr));
    gap:12px;
    margin:0 0 16px;
}

.out-kpi-card{
    display:flex;
    flex-direction:column;
    gap:2px;
    padding:14px 16px;
    border:1px solid var(--line);
    border-radius:12px;
    background:var(--surface);
    box-shadow:var(--shadow-1);
    text-decoration:none;
    color:inherit;
    transition:border-color .15s ease, box-shadow .15s ease;
}

.out-kpi-card:hover{
    border-color:var(--brand-2);
    box-shadow:var(--shadow-2);
}

.out-kpi-card--on{
    border-color:var(--brand);
    box-shadow:0 0 0 2px var(--brand-tint);
}

.out-kpi-label{
    font-size:11px;
    font-weight:600;
    letter-spacing:.04em;
    text-transform:uppercase;
    color:var(--ink-dim);
}

.out-kpi-value{
    font-size:24px;
    font-weight:700;
    line-height:1.15;
    font-variant-numeric:tabular-nums;
    color:var(--ink);
}

.out-kpi-card--green .out-kpi-value{ color:#2f7d49; }
.out-kpi-card--amber .out-kpi-value{ color:#a8742a; }

@media(max-width:900px){
    .out-kpi{
        grid-template-columns:repeat(2, minmax(0, 1fr));
    }
}

@media(max-width:520px){
    .out-kpi{
        grid-template-columns:1fr;
    }
}

/* ---- pager: one page of rows is in the DOM at a time ---- */

/* When the WH mirror was last refreshed: the Detail page reads Lark live,
   so a stale mirror must announce itself rather than look untouched. */
.out-mirror{
    margin:0 0 10px;
    font-size:12px;
    color:var(--ink-dim);
}

.out-mirror--stale{
    color:#a8742a;
}

/* The \* marks a qty taken from the approval because the warehouse has
   not picked the PO yet. */
.qty-est{
    margin-left:2px;
    color:var(--ink-dim);
    font-weight:700;
}

.out-pager{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    flex-wrap:wrap;
    margin:12px 0 4px;
    padding:10px 12px;
    border:1px solid var(--line);
    border-radius:12px;
    background:var(--surface);
}

.out-pager-count{
    font-size:12.5px;
    color:var(--ink-dim);
    font-variant-numeric:tabular-nums;
}

.out-pager-nav{
    display:flex;
    align-items:center;
    gap:10px;
}

.out-pager-info{
    font-size:12.5px;
    color:var(--ink-soft);
    white-space:nowrap;
}

/* The disabled arrow is a span, so it never looks clickable. */
.out-pager .is-off{
    opacity:.4;
    cursor:default;
    pointer-events:none;
}

.out-pager-size{
    display:flex;
    align-items:center;
    gap:6px;
    font-size:12.5px;
    color:var(--ink-dim);
}

.out-size{
    padding:3px 9px;
    border:1px solid var(--line);
    border-radius:8px;
    font-size:12px;
    color:var(--ink-soft);
    text-decoration:none;
}

.out-size:hover{
    border-color:var(--brand-2);
    color:var(--forest);
}

.out-size--on{
    background:var(--forest);
    border-color:var(--forest);
    color:#fff;
}

@media(max-width:680px){
    .out-pager{
        justify-content:center;
    }
}


/* ---- sidebar icons: inline SVG strokes ---- */

.sidebar .icon{
    width:18px;
    height:18px;
    flex:0 0 18px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.7;
    stroke-linecap:round;
    stroke-linejoin:round;
    display:block;
}

.sidebar .sidebar-icon{
    width:18px;
    height:18px;
    flex:0 0 18px;
    font-size:0;
    opacity:.9;
}

.sidebar .sidebar-link--on .sidebar-icon{
    opacity:1;
}

.sidebar .sidebar-caret{
    width:14px;
    height:14px;
    flex:0 0 14px;
    margin-left:auto;
    opacity:.7;
    transition:transform .15s ease;
}

.sidebar .sidebar-toggle .icon,
.sidebar .sidebar-sync-btn .icon{
    width:16px;
    height:16px;
    stroke-width:2;
}

/* ==========================================
   SIDEBAR
========================================== */

:root{
    --sidebar-w:220px;
    --sidebar-w-rail:64px;
    /* --forest lives in the theme block above; not repeated here. */
}

/* Two-column grid inside the existing page container: the sidebar, then
   everything else. `minmax(0,1fr)` keeps a wide table from pushing the
   column out, and every child carries `min-width:0` so a long row of
   pills or a nowrap toolbar shrinks and wraps instead of being clipped
   past the right edge when the sidebar is expanded. */
.container,
.container--wide{
    display:grid;
    grid-template-columns:var(--sidebar-w) minmax(0, 1fr);
    grid-template-rows:auto 1fr auto;
    grid-template-areas:
        "sidebar header"
        "sidebar content"
        "sidebar footer";
    /* Stretch, not start: a row that is only as tall as its content
       leaves the sticky sidebar nothing to stick to on a short page, and
       pins it to the top instead of the full column height. */
    align-items:stretch;
    width:100%;
    max-width:100%;
    margin:0;
    min-height:100vh;
    background:var(--surface);
    /* No transition here on purpose. Animating `grid-template-columns` (or
       any width/padding/margin-left) reflows the main column on every
       frame, and the Outbound table is now only 25-50 rows of that; the
       previous version reflowed 1,045 rows per frame and the page froze.
       The fold is an instant toggle instead - one layout, no frames. */
}

/* The main column next to the sidebar: `min-w-0` is the "flex-1 min-w-0"
   equivalent for a grid track. Without it the track's automatic minimum
   is the widest unbreakable child (a nowrap toolbar, a chip row), so the
   expanded sidebar squeezed the page past the viewport instead of letting
   those rows wrap. */
.container > .content,
.container--wide > .content,
.container > .header,
.container--wide > .header,
.container > .header--slim,
.container--wide > .header--slim,
.container > .footer,
.container--wide > .footer{
    min-width:0;
    max-width:100%;
    overflow-x:clip;
}

.container > .header,
.container--wide > .header,
.container > .header--slim,
.container--wide > .header--slim{
    grid-area:header;
}

.container > .content,
.container--wide > .content{
    grid-area:content;
}

.container > .footer,
.container--wide > .footer{
    grid-area:footer;
}

.container > .sidebar,
.container--wide > .sidebar{
    grid-area:sidebar;
}

/* Collapsed: a rail of icons. */
.container.container--rail,
.container--wide.container--rail{
    grid-template-columns:var(--sidebar-w-rail) minmax(0, 1fr);
}

/* ---- the panel ----

   Full viewport height, stuck to the top of the viewport for the whole
   scroll of a long page. `align-self:stretch` (not `start`) is what
   matters: a grid item defaulting to `start` is only as tall as its
   content, so `height:100vh` plus `sticky` still let the panel ride up
   and the footer scrolled away with the page. Stretching it makes the
   aside exactly one viewport tall for the entire column.

   `overflow:hidden` is kept deliberately: the *menu* scrolls internally
   (`.sidebar-menu`), so the footer can never be pushed out of view by a
   long menu. */

.sidebar{
    position:sticky;
    top:0;
    align-self:stretch;
    display:flex;
    flex-direction:column;
    justify-content:flex-start;
    gap:6px;
    width:100%;
    height:100vh;
    /* Dynamic viewport units keep the footer visible on mobile browsers
       where the URL bar changes the visible height. */
    height:100dvh;
    max-height:100vh;
    max-height:100dvh;
    padding:14px 10px 12px;
    box-sizing:border-box;
    background:#f7f9f8;
    border-right:1px solid var(--line);
    overflow:hidden;
    /* Its own stacking context, so it never slides under a sticky header. */
    z-index:30;
}

/* ---- header: brand + toggle ---- */

.sidebar-top{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:6px;
    padding:2px 2px 10px;
}

.sidebar-brand{
    display:flex;
    align-items:center;
    min-width:0;
    /* Only the logo shows; kept for the cursor and the old text markup. */
    text-decoration:none;
    overflow:hidden;
    /* No background artwork: the <img> inside is the only thing that
       draws the logo, so it cannot be painted twice or tiled. */
    background:none;
    background-repeat:no-repeat;
}

/* ---- brand: the company logo in place of the "PO Importer" text ----

   logo.png stacks a 1x (356x96) and a 2x (712x192) copy at the same spot,
   so the box is the 1x ratio with two device pixels of logo per CSS pixel.
   A fixed height with `object-fit:contain` keeps that ratio whatever the
   sidebar width, instead of stretching the wordmark. */

.sidebar-brand-logo{
    display:block;
    flex:0 1 auto;
    width:auto;
    height:32px;
    max-width:100%;
    /* The artwork is one 356x96 mark; `contain` keeps that ratio inside
       the 32px box so it is never squashed, and `no-repeat` means a stray
       background can never tile it down the column. */
    object-fit:contain;
    object-position:left center;
    background:none;
    background-repeat:no-repeat;
}

.sidebar-toggle{
    flex:0 0 auto;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:28px;
    height:28px;
    padding:0;
    border:1px solid var(--line);
    border-radius:8px;
    background:var(--surface);
    color:var(--ink-soft);
    cursor:pointer;
}

.sidebar-toggle:hover{
    border-color:var(--brand-2);
    color:var(--forest);
}

/* ---- menu ---- */

.sidebar-menu{
    display:flex;
    flex-direction:column;
    gap:2px;
    flex:1 1 auto;
    min-height:0;
    overflow-y:auto;
}

.sidebar-link{
    display:flex;
    align-items:center;
    gap:10px;
    width:100%;
    box-sizing:border-box;
    padding:9px 10px;
    border:0;
    border-radius:9px;
    background:none;
    color:var(--ink-soft);
    font-family:inherit;
    font-size:13.5px;
    font-weight:500;
    text-align:left;
    text-decoration:none;
    white-space:nowrap;
    cursor:pointer;
}

.sidebar-link:hover{
    background:rgba(46,111,64,.08);
    color:var(--forest);
}

.sidebar-link--on{
    background:var(--forest);
    color:#fff;
    font-weight:600;
}

.sidebar-link--on:hover{
    background:var(--forest);
    color:#fff;
}

.sidebar-label{
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
}

/* ---- Approval group ---- */

.sidebar-sub{
    display:none;
    flex-direction:column;
    gap:2px;
    margin:2px 0;
}

.sidebar-group--open > .sidebar-sub{
    display:flex;
}

.sidebar-link--sub{
    padding-left:34px;
    font-size:13px;
}

.sidebar-group--open > .sidebar-link--parent .sidebar-caret{
    transform:rotate(180deg);
}

/* ---- footer: live status + manual sync ----

   `margin-top:auto` pushes this to the bottom edge of the panel however
   short the menu is, so "Lark Base" and the sync button always sit on the
   viewport's bottom edge rather than floating up under the menu. */

.sidebar-foot{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    margin-top:auto;
    padding:10px 6px 2px;
    border-top:1px solid var(--line);
    flex:0 0 auto;
}

.sidebar-status{
    display:flex;
    align-items:center;
    gap:7px;
    min-width:0;
    font-size:11.5px;
    color:var(--ink-dim);
    white-space:nowrap;
    overflow:hidden;
}

.sidebar-status .nav-dot{
    flex:0 0 auto;
    background:var(--forest);
    box-shadow:0 0 0 3px rgba(46,111,64,.18);
}

.sidebar-sync{
    margin:0;
    flex:0 0 auto;
}

.sidebar-sync-btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:28px;
    height:28px;
    padding:0;
    border:1px solid var(--line);
    border-radius:8px;
    background:var(--surface);
    color:var(--forest);
    cursor:pointer;
}

.sidebar-sync-btn:hover{
    border-color:var(--forest);
    background:rgba(46,111,64,.08);
}

/* ---- collapsed rail ---- */

.sidebar--collapsed .sidebar-brand,
.sidebar--collapsed .sidebar-label,
.sidebar--collapsed .sidebar-caret{
    display:none;
}

/* The rail is 64px wide with 10px side padding, so the logo shrinks to
   fit that ~44px instead of being cut off by `.sidebar{overflow:hidden}`. */
.sidebar--collapsed .sidebar-brand-logo{
    /* The rail is narrower than the logo is wide, so keep the ratio and
       let `contain` fit it rather than stretching it to 100% width. */
    height:auto;
    width:100%;
    max-height:44px;
    object-fit:contain;
}

.sidebar--collapsed .sidebar-top{
    justify-content:center;
}

.sidebar--collapsed .sidebar-link{
    justify-content:center;
    padding-left:0;
    padding-right:0;
}

.sidebar--collapsed .sidebar-link--sub{
    padding-left:0;
}

.sidebar--collapsed .sidebar-foot{
    flex-direction:column;
    gap:8px;
}

.sidebar--collapsed .sidebar-status{
    justify-content:center;
}

/* The old top bar is gone. */
.nav{
    display:none;
}

/* The fold is an instant toggle for everyone, so there is no motion left
   to switch off. These rules stay as a guard: if a transition on the
   container is ever reintroduced it is disabled for these users. */
@media (prefers-reduced-motion: reduce){
    .container,
    .container--wide,
    .sidebar{
        transition:none;
        animation:none;
    }
}

@media(max-width:820px){
    .container,
    .container--wide{
        grid-template-columns:var(--sidebar-w-rail) minmax(0, 1fr);
    }

    .sidebar .sidebar-brand,
    .sidebar .sidebar-label,
    .sidebar .sidebar-caret{
        display:none;
    }

    .sidebar .sidebar-link{
        justify-content:center;
        padding-left:0;
        padding-right:0;
    }

    .sidebar-top{
        justify-content:center;
    }
}

/* ==========================================
   APPROVAL: CATEGORY PILLS + INLINE ITEMS

   One soft colour per product line, matched by `category_slug`. The
   tones are muted on purpose: the column is context, not a warning, and
   the status pills next to it are the ones that need to shout.
========================================= */

.cat-pill{
    display:inline-block;
    padding:3px 10px;
    border:1px solid transparent;
    border-radius:999px;
    font-size:11.5px;
    font-weight:600;
    line-height:1.5;
    white-space:nowrap;
    max-width:100%;
    overflow:hidden;
    text-overflow:ellipsis;
    vertical-align:middle;
}

/* EcoFlow -> soft rose */
.cat-pill--ecoflow{
    background:#fdeef0;
    border-color:#f6d3d8;
    color:#a83a4d;
}

/* DJI Agriculture Sparepart -> soft teal */
.cat-pill--dji-sparepart{
    background:#e6f5f4;
    border-color:#c6e6e4;
    color:#1f6f69;
}

/* DJI Agriculture Unit -> soft amber */
.cat-pill--dji-unit{
    background:#fdf3e0;
    border-color:#f3dfb5;
    color:#8a5f16;
}

/* anything else -> soft grey */
.cat-pill--other{
    background:#eef1f0;
    border-color:#dde3e1;
    color:#4b6156;
}

/* ---- the expand toggle ---- */

.row-toggle{
    display:inline-flex;
    align-items:center;
    gap:5px;
}

.row-toggle .chevron{
    width:13px;
    height:13px;
    stroke-width:2.2;
    vertical-align:0;
    /* Cheap: only the glyph turns, nothing re-lays out. */
    transition:transform .15s ease;
}

.row-toggle[aria-expanded="true"] .chevron{
    transform:rotate(180deg);
}

.outbound-row--open{
    background:var(--surface-2);
}

/* ---- the drawer ---- */

.items-row > td{
    padding:0;
    background:var(--surface-2);
    border-bottom:1px solid var(--line);
}

.items-panel{
    padding:10px 14px 14px 48px;
}

.items-table{
    width:100%;
    border-collapse:collapse;
    font-size:12.5px;
}

.items-table th{
    padding:6px 10px;
    text-align:left;
    font-size:11px;
    font-weight:600;
    letter-spacing:.04em;
    text-transform:uppercase;
    color:var(--ink-dim);
    border-bottom:1px solid var(--line);
    white-space:nowrap;
}

.items-table th.num,
.items-table td.num{
    text-align:right;
    white-space:nowrap;
    font-variant-numeric:tabular-nums;
}

.items-table td{
    padding:6px 10px;
    border-bottom:1px solid var(--line-soft);
    vertical-align:top;
    color:var(--ink-soft);
}

.items-table tbody tr:last-child td{
    border-bottom:0;
}

/* Item names arrive with hard line breaks from the Base; keep them
   readable rather than collapsing them into one long run. */
.items-name{
    white-space:pre-line;
    word-break:break-word;
}

.items-more,
.items-empty{
    margin:8px 0 0;
    font-size:12px;
    color:var(--ink-dim);
}

@media(max-width:680px){
    .items-panel{
        padding-left:14px;
    }
}

/* ==========================================
   QC: INLINE ROW ACTION

   The common case is one material at a time, so the QC column carries a
   one-click button where there is prepared quantity that has not passed
   yet. It submits the same form as the bulk bar, with its own record id,
   so no checkbox is needed.
========================================= */

.qc-row-btn{
    display:inline-flex;
    align-items:center;
    gap:4px;
    margin-top:6px;
    padding:3px 9px;
    border:1px solid #bfe3cb;
    border-radius:8px;
    background:var(--brand-tint);
    color:var(--brand-ink);
    font-family:inherit;
    font-size:11.5px;
    font-weight:600;
    line-height:1.6;
    white-space:nowrap;
    cursor:pointer;
}

.qc-row-btn:hover{
    background:var(--forest);
    border-color:var(--forest);
    color:#fff;
}

.qc-row-btn:focus-visible{
    outline:2px solid var(--brand-2);
    outline-offset:2px;
}

/* The bulk bar keeps its buttons on one line and drops the helper text. */
.qc-actions{
    display:flex;
    align-items:center;
    gap:8px;
    flex-wrap:wrap;
}

/* ==========================================
   PURCHASE ORDERS: KPI CARDS, SEGMENTED PROGRESS

   The list answers "what is coming, how much of it, and what needs
   chasing" without opening a CAS. The progress track is split into the
   two things that matter: what landed, and what is on a truck.
========================================= */

/* A fourth tone the Outbound cards do not need: on a truck. */
.out-kpi-card--blue .out-kpi-value{
    color:#2563a8;
}

.out-kpi-card--blue.out-kpi-card--on{
    border-color:#2563a8;
    box-shadow:0 0 0 2px #dbe9f7;
}

.out-kpi-sub{
    font-size:11.5px;
    color:var(--ink-dim);
    white-space:nowrap;
}

.po-kpi{
    margin-bottom:14px;
}

/* ---- the summary alerts ---- */

.po-alerts{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    margin:0 0 12px;
}

.po-alert{
    padding:3px 10px;
    border-radius:999px;
    font-size:11.5px;
    font-weight:600;
}

.po-alert--awb{
    background:#fdf3e0;
    border:1px solid #f3dfb5;
    color:#8a5f16;
}

.po-alert--eta{
    background:#fdeef0;
    border:1px solid #f6d3d8;
    color:#a83a4d;
}

/* ---- segmented progress ---- */

.meter--seg{
    display:inline-flex;
    overflow:hidden;
    background:#e6ece8;
}

.meter-seg{
    display:block;
    height:100%;
    flex:0 0 auto;
}

/* Landed. */
.meter-seg--tiba{
    background:linear-gradient(90deg,var(--brand),var(--brand-2));
}

/* On a CIPL, not arrived yet. */
.meter-seg--transit{
    background:linear-gradient(90deg,#3d7fc4,#63a5e0);
}

/* On the Outbound list the two segments mean QC state, not shipping:
   green has passed inspection, amber is prepared and still waiting. */
.meter-seg--qc-passed{
    background:linear-gradient(90deg,var(--brand),var(--brand-2));
}

.meter-seg--qc-waiting{
    background:linear-gradient(90deg,#e0a63c,#f0c469);
}

/* Just "89%": the counts moved into the cell's title attribute. */
.outbound-table .meter-text{
    min-width:38px;
    text-align:right;
}

/* ---- ETA / Info cell ---- */

.eta-cell{
    white-space:nowrap;
    line-height:1.9;
}

.eta-date{
    display:inline-block;
    padding:1px 7px;
    border-radius:7px;
    background:var(--surface-3);
    color:var(--ink-soft);
    font-size:11.5px;
    font-variant-numeric:tabular-nums;
}

.eta-date--lewat{
    background:#fdeef0;
    color:#a83a4d;
}

.eta-date--hari-ini{
    background:#eaf6ee;
    color:#1f6f3f;
}

.eta-badge{
    display:inline-block;
    margin-left:5px;
    padding:1px 7px;
    border-radius:7px;
    font-size:10.5px;
    font-weight:700;
    letter-spacing:.02em;
    text-transform:uppercase;
}

.eta-badge--late{
    background:#fdeef0;
    color:#a83a4d;
}

.eta-badge--awb{
    background:#fdf3e0;
    color:#8a5f16;
}

/* ---- the in-transit status pill ---- */

.pill--transit{
    background:#e7f0fa;
    color:#2563a8;
}

/* Part of the order has shipped, the rest is still owed. Teal rather than
   the red of an empty shelf: goods are going out on this PO. */
.pill--partial{
    background:#e2f4f1;
    color:#1c6b62;
}

@media(max-width:760px){
    .out-kpi-sub{
        white-space:normal;
    }
}

/* ==========================================
   QC & SN CARD: RECORDED SERIAL NUMBERS

   A list of only the materials that carry serial numbers. There is no
   ratio or meter any more: most parts on a PO are never serialised, so a
   share of ordered units was measuring nothing.
========================================= */

.sn-board{
    margin-top:10px;
    padding-top:10px;
    border-top:1px solid var(--line-soft);
    display:flex;
    flex-direction:column;
    gap:10px;
    max-height:260px;
    overflow-y:auto;
}

.sn-item{
    display:flex;
    flex-direction:column;
    gap:5px;
}

.sn-item-head{
    display:flex;
    align-items:baseline;
    justify-content:space-between;
    gap:10px;
}

.sn-item-name{
    display:flex;
    flex-wrap:wrap;
    align-items:baseline;
    gap:6px;
    min-width:0;
    font-size:12px;
    color:var(--ink);
}

/* "BC.AG.SS001253 · Downward Radar Module" */
.sn-item-name .mono{
    font-weight:600;
}

.sn-item-name .mono + .sn-item-title::before{
    content:"\00b7";
    margin-right:6px;
    color:var(--ink-dim);
}

.sn-item-title{
    color:var(--ink-soft);
    font-size:11.5px;
}

.sn-item-qty{
    flex:0 0 auto;
    padding:1px 8px;
    border-radius:999px;
    background:var(--surface-3);
    color:var(--ink-soft);
    font-size:11px;
    font-weight:600;
    white-space:nowrap;
}

.sn-chips{
    display:flex;
    flex-wrap:wrap;
    gap:5px;
}

.sn-chip{
    padding:2px 8px;
    border:1px solid var(--line);
    border-radius:7px;
    background:var(--surface);
    color:var(--ink-soft);
    font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
    font-size:11px;
    line-height:1.6;
    letter-spacing:.01em;
    cursor:pointer;
    white-space:nowrap;
}

.sn-chip:hover{
    border-color:var(--brand-2);
    color:var(--forest);
    background:var(--brand-tint);
}

.sn-chip:focus-visible{
    outline:2px solid var(--brand-2);
    outline-offset:1px;
}

.sn-chip--copied{
    border-color:var(--forest);
    background:var(--forest);
    color:#fff;
}


/* ==========================================
   WAREHOUSE VALUATION  (/reports/valuation)

   Four KPI tiles, a top-10 bar chart, a category breakdown and the
   sortable table. Everything is plain CSS bars and rows - no chart
   library - so the page is one request and renders before any script.
========================================= */

/* The column chart bar is a label / track / value row; this variant adds
   the SKU code and the item name above the bar, which is what the top-10
   list needs and a plain `.chart-bar` cannot show. */
.val-card{
    min-width:0;
}

.val-kpis{
    grid-template-columns:repeat(4,minmax(0,1fr));
}

/* Money is wider than a count: the total would wrap on a laptop at the
   same size the other tiles use. */
.val-kpi .kpi-value{
    font-size:22px;
    font-variant-numeric:tabular-nums;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

/* ---- the "the Base has no price column" warning ---- */

.val-warning{
    margin:0 0 16px;
    padding:12px 16px;
    border:1px solid #e6b45c;
    border-left-width:4px;
    border-radius:12px;
    background:#fdf6e8;
    color:#6b4d13;
    font-size:13px;
    line-height:1.6;
}

.val-warning code{
    padding:1px 6px;
    border-radius:5px;
    background:rgba(0,0,0,.06);
    font-family:Consolas,"Cascadia Mono",monospace;
    font-size:12px;
}

/* ---- top 10 ---- */

.val-top-bars{
    gap:10px;
}

.val-top-bar{
    grid-template-columns:minmax(0,1fr) minmax(80px,1.1fr) minmax(96px,auto);
    grid-template-areas:
        "name  name  value"
        "track track meta";
    row-gap:4px;
}

.val-top-name{
    grid-area:name;
    display:flex;
    align-items:baseline;
    gap:8px;
    min-width:0;
}

.val-code{
    flex:0 0 auto;
    font-family:Consolas,"Cascadia Mono",monospace;
    font-size:11.5px;
    color:var(--ink);
    font-weight:600;
}

.val-item-name{
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    font-size:11.5px;
    color:var(--ink-dim);
}

.val-top-bar .bar-track{
    grid-area:track;
}

.val-top-bar .bar-value{
    grid-area:value;
    white-space:nowrap;
}

.val-top-meta{
    grid-area:meta;
    text-align:right;
    font-size:11px;
    color:var(--ink-dim);
    white-space:nowrap;
    font-variant-numeric:tabular-nums;
}

/* ---- table ---- */

.val-table{
    min-width:900px;
}

.val-table td.val-total-cell{
    color:var(--forest);
    font-variant-numeric:tabular-nums;
    white-space:nowrap;
}

.val-table .val-row--empty td{
    color:var(--ink-dim);
}

.val-name-cell{
    max-width:320px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.val-tag{
    display:inline-block;
    margin-left:7px;
    padding:1px 7px;
    border:1px solid var(--line);
    border-radius:999px;
    background:var(--surface-2);
    color:var(--ink-dim);
    font-size:10.5px;
    line-height:1.6;
    vertical-align:middle;
    white-space:nowrap;
}

.val-share-cell{
    white-space:nowrap;
}

.val-share-bar{
    display:inline-block;
    width:44px;
    height:5px;
    margin-right:7px;
    border-radius:999px;
    background:var(--surface-3);
    overflow:hidden;
    vertical-align:middle;
}

.val-share-fill{
    display:block;
    height:100%;
    border-radius:999px;
    background:var(--brand-2);
}

/* ---- pager ---- */

.val-pager{
    gap:8px;
}

.val-page{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width:34px;
    text-decoration:none;
}

.val-page--on{
    border-color:var(--forest);
    background:var(--forest);
    color:#fff;
    cursor:default;
}

.val-gap{
    color:var(--ink-dim);
    font-size:12.5px;
    padding:0 2px;
}

.val-pager-sizes{
    display:inline-flex;
    align-items:center;
    gap:5px;
    margin-left:8px;
    font-size:12px;
    color:var(--ink-dim);
}

.val-size--on{
    border-color:var(--forest);
    color:var(--forest);
    font-weight:650;
}

.btn-svg{
    width:15px;
    height:15px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.9;
    stroke-linecap:round;
    stroke-linejoin:round;
}

@media(max-width:1180px){

    .val-kpis{
        grid-template-columns:repeat(2,minmax(0,1fr));
    }

}

@media(max-width:700px){

    .val-kpis{
        grid-template-columns:1fr;
    }

    .val-kpi .kpi-value{
        font-size:20px;
    }

}

/* Hooks the valuation template names explicitly. They carry no visual
   weight of their own except where noted, so a later change to one
   section does not have to reach into a base rule. */

.val-charts{
    /* The top-10 card is the only chart on the page, so it takes the full
       width: ten rows of SKU code, name and Rp value need the room a
       two-column grid would take away. */
    grid-template-columns:minmax(0, 1fr);
}

.val-chips{
    margin-top:2px;
}

.val-code-cell{
    white-space:nowrap;
}

/* the page-size links are anchors, so they need the button's shape */
.val-size{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width:34px;
    text-decoration:none;
}

.val-size--on{
    border-color:var(--forest);
    color:var(--forest);
    font-weight:650;
}
