* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Tahoma, Arial, sans-serif;
  background: #eef3f9;
  color: #0f172a;
}
.topbar {
  margin: 12px auto 0;
  width: calc(100vw - 36px);
  background: linear-gradient(90deg, #0f172a, #0f766e);
  color: white;
  border-radius: 0 0 18px 18px;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.topbar h1 { margin: 0; font-size: 24px; }
.topbar p { margin: 6px 0 0; opacity: .9; }
main { width: calc(100vw - 36px); margin: 14px auto 40px; }
.card {
  background: white;
  border: 1px solid #d8e2ef;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
  padding: 18px;
  margin-bottom: 14px;
}
h2 { margin: 0 0 14px; font-size: 20px; }
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
label { display: block; font-weight: 800; font-size: 13px; }
input, select, textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  min-height: 38px;
  padding: 8px 10px;
  margin-top: 6px;
  font-family: inherit;
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid #2563eb;
  border-color: #2563eb;
}
button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 900;
  font-family: inherit;
  cursor: pointer;
}
.primary { background: #1d4ed8; color: white; }
.secondary { background: #e2e8f0; color: #0f172a; }
.ghost { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); color: white; }
.hidden { display: none !important; }
.msg { margin-top: 10px; font-weight: 800; }
.msg.ok { color: #15803d; }
.msg.err { color: #b91c1c; }
.muted { color: #64748b; margin-top: 8px; font-size: 12px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-title p { margin: 4px 0 0; color: #64748b; }
.table-card { padding: 0; overflow: hidden; }
.table-card .section-title { padding: 18px; background: linear-gradient(90deg, #0f172a, #164e63); color: white; }
.table-card .section-title p { color: #dbeafe; }
.table-scroll { overflow-x: auto; }
table {
  width: 100%;
  min-width: 1800px;
  border-collapse: collapse;
  table-layout: fixed;
}
th {
  background: #e5e7eb;
  border: 1px solid #94a3b8;
  padding: 8px 6px;
  text-align: center;
  font-size: 12px;
  white-space: nowrap;
}
td {
  border: 1px solid #cbd5e1;
  padding: 4px;
  text-align: center;
  background: white;
}
tr.entry-row td { background: #eff6ff; }
td input { margin: 0; min-height: 34px; text-align: center; }
.product-input { text-align: right !important; }
.num { font-weight: 900; }
.net-cell { background: #ecfeff !important; font-weight: 900; }
.actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.row-actions { display: flex; gap: 6px; justify-content: center; }
.row-actions button { padding: 7px 9px; border-radius: 7px; font-size: 12px; }
.del { background: #fee2e2; color: #991b1b; }
.add { background: #16a34a; color: white; }
.summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 12px;
  background: #f8fafc;
  border-top: 1px solid #d8e2ef;
}
.sum-card {
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}
.sum-card span { color: #475569; font-size: 12px; font-weight: 800; }
.sum-card b { display: block; font-size: 22px; margin-top: 6px; }
.sum-card.green { background: #ecfdf5; border-color: #86efac; }
.product-panel {
  position: fixed;
  z-index: 9999;
  background: white;
  border: 2px solid #2563eb;
  border-radius: 10px;
  box-shadow: 0 16px 34px rgba(15,23,42,.24);
  max-height: 360px;
  overflow: auto;
  min-width: 420px;
  max-width: 720px;
}
.product-panel .head {
  padding: 9px 12px;
  background: #eff6ff;
  color: #1e3a8a;
  font-weight: 900;
  border-bottom: 1px solid #bfdbfe;
}
.product-panel .item {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  cursor: pointer;
  line-height: 1.5;
}
.product-panel .item:hover { background: #dbeafe; }
.checkline { display: flex; align-items: center; gap: 8px; padding-top: 24px; }
.checkline input { width: auto; min-height: auto; margin: 0; }
@media (max-width: 1100px) {
  .grid-5, .grid-3, .grid-2, .summary { grid-template-columns: 1fr; }
}
