:root {
  --ink: #1c2430;
  --muted: #5c6775;
  --line: #d5dbe3;
  --paper: #ffffff;
  --bg: #eef1f5;
  --accent: #1e4d8c;
  --soft: #f6f8fb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.45 "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.login-wrap {
  max-width: 420px;
}

.login-card .field {
  margin-bottom: 12px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.topbar-user {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 6px;
}

.button.small {
  padding: 6px 10px;
  font-size: 13px;
}

h1 {
  font-size: 26px;
  line-height: 1.2;
  margin: 0 0 6px;
}

h2 {
  font-size: 18px;
  margin: 0 0 12px;
}

.lede {
  color: var(--muted);
  margin: 0 0 20px;
  max-width: 680px;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

label.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
  min-width: 160px;
  flex: 1;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="file"],
select,
textarea {
  font: inherit;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 42px;
  width: 100%;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

input[type="password"] {
  font-family: inherit;
}

textarea { min-height: 64px; resize: vertical; }

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

button,
.button {
  font: inherit;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

button.secondary,
.button.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

button.small {
  padding: 6px 10px;
  font-size: 13px;
}

button.ghost {
  background: #fff;
  color: #8a2b2b;
  border: 1px solid #e7cccc;
  padding: 6px 8px;
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

.note, .warn, .error {
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 14px;
}

.note { background: var(--soft); color: var(--muted); }
.warn { background: #fff8e8; color: #6b5316; }
.error { background: #fdecec; color: #8a2b2b; }

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

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

table.products th,
table.products td {
  border-bottom: 1px solid var(--line);
  padding: 8px 4px;
  vertical-align: top;
  text-align: left;
  font-size: 14px;
}

table.products th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

table.products th:nth-child(1),
table.products td:nth-child(1) { width: 56px; }
table.products th:nth-child(2),
table.products td:nth-child(2) { width: auto; }
table.products th:nth-child(3),
table.products td:nth-child(3) { width: 92px; }
table.products th:nth-child(4),
table.products td:nth-child(4) { width: 48px; }
table.products th:nth-child(5),
table.products td:nth-child(5) { width: 48px; }
table.products th:nth-child(6),
table.products td:nth-child(6) { width: 72px; }
table.products th:nth-child(7),
table.products td:nth-child(7) { width: 72px; }
table.products th:nth-child(8),
table.products td:nth-child(8) { width: 72px; }

table.products input[type="text"],
table.products select {
  padding: 7px 6px;
}

table.products input.qty,
table.products input.vat,
table.products input.price,
table.products input.value {
  width: 100%;
  text-align: right;
}

table.products select {
  width: 100%;
}

table.products input.name {
  min-width: 0;
  width: 100%;
}

.check {
  width: 18px;
  height: 18px;
  margin-top: 8px;
}

.thumb {
  width: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.review-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 8px;
}

details {
  margin-top: 8px;
  color: var(--muted);
}

details pre {
  white-space: pre-wrap;
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--soft);
  padding: 10px;
  border-radius: 8px;
}

@media (max-width: 800px) {
  .grid, .totals { grid-template-columns: 1fr 1fr; }
  .review-head { flex-direction: column; }
}
