body{
  font-family: Arial, sans-serif;
  background:#f7f7f7;
  color:#111;
  margin:0;
}

.wrap{
  max-width:1000px;
  margin:0 auto;
  padding:20px;
}

.topbar{
  background:#111;
  color:#fff;
  padding:14px 20px;
  overflow-x:auto;
  white-space:nowrap;
  -webkit-overflow-scrolling:touch;
}

.topbar a{
  display:inline-block;
  color:#fff;
  text-decoration:none;
  margin-right:14px;
}

h1,h2,h3{
  margin-top:0;
}

.card{
  background:#fff;
  border:1px solid #e5e5e5;
  border-radius:14px;
  padding:16px;
  margin-bottom:16px;
}

.grid{
  display:grid;
  gap:20px;
}

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

input, select, textarea{
  width:100%;
  padding:10px;
  border:1px solid #d9d9d9;
  border-radius:10px;
  box-sizing:border-box;
  margin-bottom:10px;
}

button, .btn{
  display:inline-block;
  background:#111;
  color:#fff;
  border:none;
  border-radius:10px;
  padding:10px 14px;
  text-decoration:none;
  cursor:pointer;
}

.btn.secondary{
  background:#666;
}

.btn.green{
  background:#0a7a35;
}

.btn.red{
  background:#b42318;
}

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

.table th,
.table td{
  padding:10px;
  border-bottom:1px solid #eee;
  text-align:left;
  vertical-align:top;
}

.table-wrap{
  width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}

.table-mobile-safe{
  min-width:900px;
}

.table.table-fixed{
  width:100%;
  table-layout:fixed !important;
}

.table-fixed th,
.table-fixed td{
  overflow:hidden;
}

.cell-truncate{
  display:block;
  width:100%;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}

.nowrap{
  white-space:nowrap;
}

.w-item{width:62%;}
.w-unit{width:8%;}
.w-price{width:10%;}
.w-action{width:20%;}

.muted{
  color:#666;
  font-size:14px;
}

.flash{
  background:#fff7d6;
  border:1px solid #f0d98c;
  padding:10px 12px;
  border-radius:10px;
  margin-bottom:16px;
}

.kpi{
  font-size:28px;
  font-weight:700;
}

.row-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

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

.row-actions-tight .btn,
.row-actions-tight button{
  min-width:auto;
  padding:8px 12px;
  text-align:center;
}

.pill{
  display:inline-block;
  padding:4px 10px;
  border-radius:999px;
  font-size:13px;
  font-weight:700;
  line-height:1;
  border:1px solid transparent;
}

.pill-draft{
  background:#f3f4f6;
  color:#374151;
  border-color:#e5e7eb;
}

.pill-sent{
  background:#dbeafe;
  color:#1d4ed8;
  border-color:#bfdbfe;
}

.pill-partial{
  background:#fef3c7;
  color:#92400e;
  border-color:#fde68a;
}

.pill-received{
  background:#dcfce7;
  color:#166534;
  border-color:#bbf7d0;
}

.pill-rejected{
  background:#fee2e2;
  color:#991b1b;
  border-color:#fecaca;
}

.pill-cancelled{
  background:#e5e7eb;
  color:#374151;
  border-color:#d1d5db;
}

.po-cards{
  display:grid;
  gap:14px;
}

.po-card-link{
  text-decoration:none;
  color:inherit;
}

.po-card{
  transition:0.15s ease;
}

.po-card:active{
  transform:scale(0.99);
}

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

.info-list{
  display:grid;
  gap:10px;
}

.filter-bar{
  display:grid;
  gap:10px;
}

@media (min-width: 769px){
  .filter-bar{
    grid-template-columns:1.4fr 1fr auto;
    align-items:end;
  }
}

@media (max-width: 768px){
  .wrap{
    padding:14px;
  }

  .topbar{
    padding:12px 14px;
  }

  .topbar a{
    margin-right:10px;
    font-size:15px;
  }

  h1, h2{
    font-size:24px;
  }

  h3{
    font-size:20px;
  }

  .card{
    padding:14px;
    border-radius:12px;
  }

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

  .row-actions{
    gap:6px;
  }

  button, .btn{
    padding:10px 12px;
    font-size:15px;
  }

  .table th,
  .table td{
    padding:8px;
    font-size:15px;
  }

  .page-head{
    align-items:stretch;
  }

  .page-head .row-actions{
    width:100%;
  }

  .page-head .row-actions .btn,
  .page-head .row-actions button{
    width:100%;
    text-align:center;
  }

  .info-list{
    gap:8px;
  }

  .table-mobile-safe{
    min-width:1050px;
  }
}

.table-fixed td.nowrap,
.table-fixed th.nowrap{
  white-space:nowrap;
}

.desktop-only{
  display:block;
}

.mobile-only{
  display:none;
}

.line-card-list{
  display:grid;
  gap:12px;
}

.line-card{
  border:1px solid #e5e5e5;
  border-radius:12px;
  padding:14px;
  background:#fff;
}

.line-card-title{
  font-weight:700;
  font-size:18px;
  margin-bottom:12px;
  line-height:1.35;
}

.line-card-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px 16px;
}

.line-card-actions{
  margin-top:14px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

@media (max-width: 768px){
  .desktop-only{
    display:none;
  }

  .mobile-only{
    display:block;
  }

  .line-card-grid{
    grid-template-columns:1fr 1fr;
  }
}
.filter-bar-po{
  display:grid;
  gap:10px;
}

.po-card-tight{
  padding:14px 16px;
}

.po-card-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  flex-wrap:wrap;
}

.po-number{
  font-size:22px;
  font-weight:700;
  line-height:1.1;
  margin-bottom:4px;
}

.po-supplier{
  font-size:14px;
}

.po-card-meta{
  margin-top:10px;
  display:grid;
  gap:2px;
  line-height:1.35;
}

@media (min-width: 769px){
  .filter-bar-po{
    grid-template-columns: 1.3fr 0.8fr 1fr 0.9fr auto;
    align-items:end;
  }
}

@media (max-width: 768px){
  .po-card-tight{
    padding:12px 14px;
  }

  .po-number{
    font-size:20px;
  }

  .po-card-meta{
    margin-top:8px;
    gap:0;
  }
}