:root {
  --bg: #f3f0e6;
  --panel: #ffffff;
  --brand: #1b5e3f;
  --brand-2: #e0a938;
  --text: #1e2a24;
  --muted: #62756b;
  --line: #d8e0db;
  --danger: #9a1d1d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: linear-gradient(140deg, #fbfaf4, #eeebde 60%, #e7e3d5);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.topbar {
  background: #123e2a;
  color: #f6f2e7;
  padding: 12px 20px;
  border-bottom: 3px solid var(--brand-2);
}

.topbar h1 {
  margin: 0;
  font-size: 21px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.nav a {
  text-decoration: none;
  color: #d4e6dc;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.nav a.active,
.nav a:hover {
  color: white;
  border-color: #76aa91;
  background: rgba(255, 255, 255, 0.08);
}

.container {
  width: min(1180px, 94vw);
  margin: 18px auto 34px;
}

.page-title {
  margin: 0 0 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.05);
}

.card h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea,
button {
  width: 100%;
  margin-top: 4px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 14px;
}

textarea { min-height: 64px; }

button {
  border: none;
  background: var(--brand);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

button:hover { opacity: 0.93; }

button.alt {
  background: var(--brand-2);
  color: #38290f;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.stat-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fdfdfb;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
}

.stat-value {
  font-weight: 700;
  font-size: 22px;
  color: var(--brand);
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 8px;
  font-size: 13px;
  white-space: nowrap;
}

.line-row {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr 0.8fr 0.8fr 1.2fr 0.7fr 0.9fr auto;
  gap: 7px;
  margin-bottom: 7px;
  align-items: center;
}

.status {
  margin-top: 12px;
  min-height: 20px;
  font-size: 13px;
  color: var(--brand);
}

.status.error { color: var(--danger); }

.report-sheet {
  margin-top: 10px;
}

.report-sheet h4 {
  margin: 0 0 8px;
}

@media (max-width: 760px) {
  .line-row {
    grid-template-columns: 1.5fr 0.9fr 0.8fr 0.8fr 1.2fr 0.7fr 0.9fr auto;
  }
}

#salesLines { min-width: 1150px; }

.inline-add { display:flex; gap:6px; align-items:center; }
.inline-add select{ flex:1; }
.mini-add{ width:36px; min-width:36px; padding:8px 0; font-size:18px; line-height:1; }

.inline-actions { display:flex; gap:8px; flex-wrap:wrap; }
.inline-actions .alt { width:auto; padding:8px 14px; }
