:root {
  --ink: #1f2933;
  --muted: #5f6b7a;
  --line: #d5dde5;
  --paper: #ffffff;
  --bg: #eef2f6;
  --top: #f7f9fb;
  --accent: #1d6fbf;
  --accent-dark: #155a9c;
  --ok: #1b7f4a;
  --bad: #c0392b;
  --warn: #b86e00;
  --chip: #e8f1fa;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", "DejaVu Sans", "Liberation Sans", sans-serif;
  font-size: 13px;
  line-height: 1.35;
}
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  background: var(--top);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: stretch;
  min-height: 42px;
  padding: 0 8px;
  gap: 8px;
}
.brand {
  display: flex;
  align-items: center;
  font-weight: 700;
  color: var(--accent-dark);
  padding: 0 8px;
  white-space: nowrap;
}
.brand a { color: inherit; text-decoration: none; }
.menu { display: flex; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.menu > li { position: relative; }
.menu > li > span,
.menu > li > a.top-link {
  display: block;
  padding: 12px 10px;
  cursor: pointer;
  color: var(--ink);
}
.menu > li:hover > span,
.menu > li:focus-within > span { color: var(--accent); }
.drop {
  display: none;
  position: absolute;
  z-index: 20;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: 0 6px 16px rgba(20, 40, 70, 0.12);
  padding: 4px 0;
}
.menu > li:hover > .drop,
.menu > li:focus-within > .drop { display: block; }
.drop a { display: block; padding: 7px 12px; color: var(--ink); }
.drop a:hover { background: var(--chip); text-decoration: none; }
.who { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.page { padding: 8px 10px 24px; }
h1 { font-size: 18px; font-weight: 600; margin: 4px 0 8px; }
h2 { font-size: 14px; margin: 12px 0 6px; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-bottom: 0;
  padding: 6px;
}
.toolbar input[type="search"],
.toolbar input[type="text"] { width: 220px; }
.btn, button, .btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: white;
  border: 1px solid var(--accent-dark);
  border-radius: 2px;
  padding: 4px 10px;
  min-height: 28px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
.btn.secondary, button.secondary { background: white; color: var(--ink); border-color: var(--line); }
.btn.quiet, button.quiet { background: #f4f7fa; color: var(--ink); border-color: var(--line); }
button:hover, .btn:hover { filter: brightness(0.97); text-decoration: none; }
.filter-toggle { position: absolute; left: -999px; }
.filters {
  display: none;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-bottom: 0;
  padding: 8px;
  gap: 8px;
}
.filter-toggle:checked ~ .filters,
.filters.open { display: flex; flex-wrap: wrap; }
label { font-weight: 600; }
.filters label { font-weight: 600; font-size: 12px; color: var(--muted); display: block; }
.field { min-width: 140px; }
input, select, textarea {
  font: inherit;
  padding: 4px 6px;
  border: 1px solid #c5d0dc;
  border-radius: 2px;
  background: white;
  min-height: 28px;
  width: 100%;
}
textarea { min-height: 64px; }
.sheet {
  background: white;
  border: 1px solid var(--line);
}
table { width: 100%; border-collapse: collapse; background: white; }
th, td { text-align: left; padding: 4px 6px; border-bottom: 1px solid #e6edf3; vertical-align: middle; }
th { background: #f3f6f9; font-weight: 600; color: #3d4c5c; white-space: nowrap; }
th a { color: inherit; }
tr:hover td { background: #f5f9fd; }
.badge { display: inline-block; border-radius: 2px; padding: 1px 6px; font-size: 12px; background: #e8eef4; }
.badge.bad { background: #fde8e6; color: var(--bad); }
.badge.soon, .badge.warn { background: #fff1d6; color: var(--warn); }
.badge.ok { background: #e5f6ec; color: var(--ok); }
.badge.info { background: var(--chip); color: var(--accent-dark); }
.messages { list-style: none; padding: 0; margin: 0 0 8px; }
.messages li { padding: 6px 8px; margin-bottom: 4px; background: #fff6e5; border: 1px solid #f0d7a4; }
.messages .error { background: #fdecea; border-color: #f5c2c0; }
.messages .success { background: #e8f7ee; border-color: #b7e0c6; }
.doc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.doc {
  background: white;
  border: 1px solid var(--line);
  padding: 8px;
}
.head {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 12px;
  margin-bottom: 8px;
}
.head .cell { min-width: 0; }
.totals { margin-top: 8px; display: flex; justify-content: flex-end; }
.totals table { width: auto; min-width: 280px; }
.pager { display: flex; justify-content: space-between; gap: 8px; padding: 6px; color: var(--muted); background: white; border: 1px solid var(--line); border-top: 0; }
.help, .muted { color: var(--muted); }
.errorlist { color: var(--bad); margin: 2px 0 0; padding-left: 16px; }
.card { background: white; border: 1px solid var(--line); padding: 8px; margin-bottom: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
@media (max-width: 800px) {
  .head { grid-template-columns: 1fr; }
  .menu > li > span { padding: 10px 8px; }
  table.stack thead { display: none; }
  table.stack tr { display: block; border-bottom: 1px solid var(--line); }
  table.stack td { display: block; text-align: right; }
  table.stack td::before { content: attr(data-label); float: left; font-weight: 600; }
}
@media print {
  .topbar, .toolbar, .doc-actions, .noprint, button { display: none !important; }
  body { background: white; }
  .page { padding: 0; }
}
