:root {
  --ink: #10233a;
  --muted: #5d6b7a;
  --line: #dfe5ec;
  --bg: #f6f8fb;
  --card: #ffffff;
  --accent: #1f5fa8;
  --accent-dark: #164a83;
  --ok: #1f7a4d;
  --warn: #8a5a00;
  --bad: #a3232b;
}

* { box-sizing: border-box; }

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

.wrap { width: min(1050px, 92vw); margin: 0 auto; }

/* header */
.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 0; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--ink); }
.brand small { display: block; color: var(--muted); font-size: 0.78rem; }
.mark { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; font-weight: 700; font-size: 0.85rem; }
.mark.large { width: 46px; height: 46px; font-size: 1rem; margin-bottom: 0.5rem; }
nav { display: flex; align-items: center; gap: 1rem; }
nav a { color: var(--ink); text-decoration: none; font-size: 0.92rem; }
nav a:hover { color: var(--accent); }

main.wrap { padding: 1.6rem 0 2.5rem; }

h1 { font-size: 1.5rem; margin: 0.2rem 0 0.3rem; }
h2 { font-size: 1.05rem; margin: 0 0 0.7rem; }
h3 { font-size: 0.95rem; margin: 1rem 0 0.4rem; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }

/* cards and grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.2rem; margin-bottom: 1.1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 1.1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stat .label { display: block; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.stat .value { display: block; font-size: 1.85rem; font-weight: 700; margin: 0.25rem 0 0.1rem; }

.bar { height: 7px; background: var(--line); border-radius: 5px; overflow: hidden; margin: 0.6rem 0 0.3rem; }
.bar-fill { height: 100%; background: var(--accent); }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
tfoot th { border-top: 2px solid var(--line); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* pills */
.pill { display: inline-block; padding: 0.12rem 0.5rem; border-radius: 999px; font-size: 0.75rem; text-transform: capitalize; background: #eef2f7; color: var(--muted); }
.pill.paid { background: #e4f4ea; color: var(--ok); }
.pill.issued { background: #e7effa; color: var(--accent-dark); }
.pill.overdue { background: #fbeaec; color: var(--bad); }
.pill.draft { background: #f4f1e6; color: var(--warn); }
.pill.void { background: #ececec; color: #666; }

/* forms */
label { display: block; margin: 0.7rem 0; font-size: 0.9rem; }
label.inline { display: inline-block; margin-right: 1rem; }
label.checkbox { display: flex; gap: 0.5rem; align-items: flex-start; }
input, select, textarea { width: 100%; padding: 0.55rem 0.65rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }
label.inline select, label.inline input { width: auto; }
input[type="checkbox"] { width: auto; margin-top: 0.25rem; }

button, .button { display: inline-block; padding: 0.55rem 1rem; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; cursor: pointer; text-decoration: none; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-dark); }
button.link { border: none; background: none; color: var(--ink); padding: 0; font-size: 0.92rem; }
button.link:hover { color: var(--accent); }
.inline { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }

/* banners */
.banner { border-radius: 10px; padding: 0.8rem 1rem; margin: 0 0 1.1rem; border: 1px solid var(--line); }
.banner.warning { background: #fdf5e6; border-color: #f0dcae; color: #6b4700; }
.banner.info { background: #e9f1fb; border-color: #cfe0f6; color: var(--accent-dark); }
.alert { background: #fbeaec; color: var(--bad); border-radius: 8px; padding: 0.6rem 0.8rem; }

/* login */
body.centered { display: grid; place-items: center; min-height: 100vh; }
.login { width: min(420px, 92vw); text-align: left; }
.login h1 { font-size: 1.3rem; }
.login button { width: 100%; margin-top: 0.4rem; }

.steps { padding-left: 1.1rem; }
.steps li { margin: 0.3rem 0; }

footer.foot { padding: 1.5rem 0 2.5rem; color: var(--muted); font-size: 0.8rem; border-top: 1px solid var(--line); }

@media (max-width: 620px) {
  .stat .value { font-size: 1.5rem; }
  nav { gap: 0.7rem; font-size: 0.85rem; }
}