:root {
  --color-bg: #faf7f2;
  --color-text: #2b2622;
  --color-accent: #6b7a4f;
  --color-accent-dark: #4f5c39;
  --color-border: #ddd5c7;
  --color-error: #b3261e;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 16px;
  line-height: 1.4;
}

h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }

a { color: var(--color-accent-dark); }

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.centered {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 2rem;
  width: min(90vw, 360px);
}

.card h1 { text-align: center; }

form label {
  display: block;
  margin-bottom: 1rem;
  font-weight: 600;
  font-size: 0.9rem;
}

input, select, button {
  font-size: 1rem;
  font-family: inherit;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
select {
  width: 100%;
  padding: 0.6rem;
  margin-top: 0.3rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
}

button {
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1.2rem;
  cursor: pointer;
}

button:hover { background: var(--color-accent-dark); }

.link-btn {
  background: none;
  color: var(--color-accent-dark);
  padding: 0;
  text-decoration: underline;
  font-size: 0.9rem;
}

.inline-form { display: inline; }

.error {
  color: var(--color-error);
  font-weight: 600;
}

.topnav {
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  padding: 0.8rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.topnav .brand { font-weight: 700; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.nav-links .user { color: #66605a; }

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-row label { flex: 1 1 220px; }

.filter-form {
  align-items: flex-end;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.filter-form label { flex: 1 1 160px; margin-bottom: 0; }

.filter-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 0 0 auto;
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

.items-table th {
  text-align: left;
  font-size: 0.85rem;
  color: #66605a;
  padding-bottom: 0.3rem;
}

.items-table td { padding: 0.3rem 0.3rem 0.3rem 0; vertical-align: middle; }

.form-actions { margin-top: 1.5rem; }

.list-table, .receipt-items {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background: #fff;
}

.list-table th, .list-table td,
.receipt-items th, .receipt-items td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

.amount { text-align: right; }

.receipt-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.receipt-paper {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 2rem;
  max-width: 480px;
}

.receipt-header { text-align: center; margin-bottom: 1.5rem; }
.receipt-header h1 { font-size: 1.3rem; }
.receipt-header p { margin: 0.1rem 0; color: #66605a; font-size: 0.9rem; }

.receipt-meta p { margin: 0.2rem 0; font-size: 0.95rem; }

.receipt-items tfoot td {
  font-weight: 700;
  border-bottom: none;
  border-top: 2px solid var(--color-text);
}

.receipt-footer {
  text-align: center;
  margin-top: 1.5rem;
  color: #66605a;
  font-size: 0.9rem;
}

@media (max-width: 600px) {
  .form-row { flex-direction: column; }
  .receipt-paper { padding: 1.2rem; }
}

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .receipt-paper { border: none; padding: 0; max-width: 100%; }
  .container { padding: 0; max-width: 100%; }
}
