:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1c1e21;
  --muted: #6b7280;
  --border: #e3e5e8;
  --accent: #c0392b;
  --accent-dark: #a93226;
  --success: #1e8e3e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.topbar .brand { font-weight: 700; font-size: 1.1rem; }

.topbar nav a {
  margin-left: 18px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
}

.topbar nav a:hover { color: var(--accent); }

.container {
  max-width: 1000px;
  margin: 28px auto;
  padding: 0 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px;
  margin-bottom: 20px;
}

h1 { font-size: 1.5rem; margin: 0 0 18px; }
h2 { font-size: 1.15rem; margin: 0 0 14px; }

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }

.btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
}
.btn:hover { background: var(--accent-dark); }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn.small { padding: 5px 10px; font-size: 0.8rem; }
.btn.danger { background: #b3261e; }

.form-group { margin-bottom: 14px; }
label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 5px; }
input, textarea, select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.92rem;
  font-family: inherit;
}
.row { display: flex; gap: 14px; }
.row > * { flex: 1; }

.flash { padding: 10px 14px; border-radius: 7px; margin-bottom: 16px; font-size: 0.9rem; }
.flash.success { background: #e6f4ea; color: var(--success); }
.flash.error { background: #fce8e6; color: #c5221f; }

.badge { padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge.draft { background: #eee; color: #555; }
.badge.sent { background: #fff4d6; color: #8a6d00; }
.badge.paid { background: #e6f4ea; color: var(--success); }

.stat { text-align: center; }
.stat .num { font-size: 1.7rem; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: 0.82rem; }

.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-card { width: 340px; }

.text-right { text-align: right; }
.muted { color: var(--muted); }

.line-row { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 8px; }
.line-row .desc { flex: 3; }
.line-row .qty, .line-row .price { flex: 1; }
