:root {
  --bg: #f2f4f8;
  --card: #ffffff;
  --ink: #1c2333;
  --muted: #6b7488;
  --line: #dde2ec;
  --accent: #1f6feb;
  --accent-ink: #ffffff;
  --ok: #1a7f37;
  --warn: #9a6700;
  --error: #cf222e;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; text-decoration: none; color: var(--ink); font-size: 17px; }
.brand span { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 8px; }

main { max-width: 1080px; margin: 0 auto; padding: 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
h2 .muted { font-weight: 400; font-size: 13px; }
.muted { color: var(--muted); font-size: 13px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 10px; font-size: 14px; }
.flash.ok    { background: #dcfce7; color: var(--ok); }
.flash.warn  { background: #fef9c3; color: var(--warn); }
.flash.error { background: #fee2e2; color: var(--error); }

input, select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  background: #fbfcfe;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input.short { max-width: 90px; }
input.date  { max-width: 130px; }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
label input, label select { margin-top: 3px; color: var(--ink); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px 14px;
}

button {
  font: inherit;
  padding: 7px 16px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.primary:hover { filter: brightness(1.08); }
button.link { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; }
button.link.danger { color: var(--error); }
button.addrow { margin-top: 8px; font-size: 13px; padding: 4px 12px; }

table.rows { width: 100%; border-collapse: collapse; }
table.rows th {
  text-align: left; font-size: 12px; color: var(--muted);
  font-weight: 600; padding: 2px 6px 6px 2px;
}
table.rows td { padding: 3px 6px 3px 0; vertical-align: top; }

table.files { width: 100%; border-collapse: collapse; }
table.files td { padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); }
table.files tr:last-child td { border-bottom: 0; }
table.files a { color: var(--accent); text-decoration: none; }
table.files a:hover { text-decoration: underline; }

.months { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0 0 14px; }
.pill {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font-size: 14px;
}
.pill:hover { border-color: var(--accent); color: var(--accent); }

.row-form { display: flex; gap: 10px; align-items: end; margin-top: 12px; flex-wrap: wrap; }
.row-form label { margin: 0; }
.row-form select, .row-form input[type=file] { width: auto; }

.sticky-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg);
  padding: 10px 0 12px;
}
.actions, .bottom-actions { display: flex; gap: 10px; }
.bottom-actions { justify-content: end; margin-bottom: 30px; }

.login { max-width: 340px; margin: 12vh auto; text-align: center; }
.login h1 { margin-bottom: 4px; }
.login form { display: grid; gap: 10px; margin-top: 16px; }

@media (max-width: 640px) {
  main { padding: 10px; }
  .card { padding: 12px; }
  table.rows { display: block; overflow-x: auto; }
}
