:root {
  --bg: #faf6ee;
  --panel: #fffaf2;
  --line: #e7d8bd;
  --gold: #bf8127;
  --gold-dark: #8b5a16;
  --text: #1d160d;
  --muted: #6f604e;
  --danger: #b3261e;
  --ok: #1f7a3a;
  --focus: #1c64f2;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
h1 { margin: 0 0 4px; font-size: 24px; }
p { margin: 0; color: var(--muted); }
.version { font-weight: 700; color: var(--gold-dark); }
.layout { padding: 18px; display: grid; gap: 16px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 8px 22px rgba(60, 44, 20, .08);
}
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
}
h2 { margin: 0 0 4px; font-size: 22px; }
button {
  border: none;
  border-radius: 10px;
  background: var(--gold);
  color: white;
  font-weight: 800;
  padding: 11px 16px;
  cursor: pointer;
}
button:focus, input:focus {
  outline: 3px solid rgba(28,100,242,.28);
  border-color: var(--focus);
}
.tax-help {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.tax-help span {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 700;
  color: var(--gold-dark);
}
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 9px 8px; text-align: left; vertical-align: middle; }
th { background: #f1e5d2; font-size: 14px; }
.entry-table th, .entry-table td { border: 1px solid var(--line); }
.entry-table th { white-space: nowrap; }
input[type="text"], input:not([type]) {
  width: 100%;
}
input {
  width: 100%;
  border: 1px solid #d9c5a6;
  border-radius: 8px;
  padding: 11px 10px;
  font-size: 18px;
  background: #fff;
}
input[type="checkbox"] {
  width: 24px;
  height: 24px;
  accent-color: var(--gold);
}
.center { text-align: center; }
.code { width: 140px; }
.tax { width: 86px; }
.price { width: 120px; }
.sell { width: 80px; text-align: center; }
.save { width: 100px; }
.message {
  min-height: 28px;
  margin-top: 10px;
  font-weight: 800;
}
.message.ok { color: var(--ok); }
.message.error { color: var(--danger); }
.table-wrap { max-height: calc(100vh - 360px); overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.list-table thead th { position: sticky; top: 0; z-index: 1; }
.list-table tbody tr:nth-child(even) { background: #fffaf4; }
.empty { text-align: center; color: var(--muted); padding: 28px; }
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 9px;
  font-weight: 800;
  background: #efe3cf;
  color: var(--gold-dark);
}
.count { color: var(--muted); font-weight: 800; }
.row-saved { animation: flash 1s ease; }
@keyframes flash { from { background: #fff0bf; } to { background: transparent; } }
@media (max-width: 900px) {
  .topbar { flex-direction: column; gap: 8px; }
  .layout { padding: 10px; }
  .panel { padding: 12px; }
}
