:root {
  --bg: #f6f5f2;
  --panel: #ffffff;
  --ink: #1f2328;
  --muted: #6b7078;
  --line: #e3e1dc;
  --accent: #2f5d62;
  --pos: #1f7a4d;
  --neg: #a33a2f;
  --warn: #8a6d1d;
  --warn-bg: #fbf4dd;
  --err-bg: #f9e3e0;
  --ok-bg: #e4f2ea;
  font-size: 15px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.45;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  display: flex; align-items: center; gap: 28px; padding: 14px 28px; background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: .06em; font-size: 13px; color: var(--ink); line-height: 1.1; }
.brand span { display: block; font-weight: 500; color: var(--muted); letter-spacing: .1em; font-size: 11px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a { padding: 6px 11px; border-radius: 6px; color: var(--muted); font-size: 14px; }
.nav a.active, .nav a:hover { background: #eef0ee; color: var(--ink); text-decoration: none; }
.topbar form { margin: 0; }
main { max-width: 1240px; margin: 0 auto; padding: 26px 28px 60px; }
h1 { font-size: 22px; margin: 0 0 18px; font-weight: 650; }
h2 { font-size: 16px; margin: 28px 0 10px; font-weight: 650; letter-spacing: .02em; }
h3 { font-size: 14px; margin: 16px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 18px; }
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3, .grid-2, .grid-4 { grid-template-columns: 1fr; } }
.stat .label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.stat .value { font-size: 26px; font-weight: 650; margin: 4px 0; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: 13px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.flat { color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; }
tr:hover td { background: #fafaf8; }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 6px 14px; }
.kv div:nth-child(odd) { color: var(--muted); }
.btn, button {
  display: inline-block; padding: 7px 14px; border-radius: 7px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font-size: 14px; cursor: pointer; font-family: inherit;
}
.btn:hover, button:hover { filter: brightness(1.08); text-decoration: none; }
.btn.secondary, button.secondary { background: #fff; color: var(--accent); }
.btn.danger, button.danger { background: #fff; color: var(--neg); border-color: var(--neg); }
button.link { background: none; border: none; color: var(--muted); padding: 6px 8px; }
form.inline { display: inline; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 3px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=datetime-local], input[type=file], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit;
  background: #fff; color: var(--ink);
}
textarea { min-height: 70px; }
.field { margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 14px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { display: flex; gap: 6px; align-items: center; color: var(--ink); font-size: 14px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; background: var(--ok-bg); }
.flash.error { background: var(--err-bg); }
.flash.info { background: #e8eef3; }
.notice { padding: 10px 14px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); margin: 10px 0; }
.notice.error { background: var(--err-bg); color: var(--neg); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #eceae5; color: var(--ink); }
.badge.ok { background: var(--ok-bg); color: var(--pos); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--neg); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.cal { table-layout: fixed; }
.cal td { height: 92px; padding: 6px 8px; border: 1px solid var(--line); }
.cal td.out { background: #faf9f6; color: #b8b6b0; }
.cal td.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal .d { font-size: 12px; color: var(--muted); }
.cal .amt { font-weight: 650; margin-top: 6px; }
.cal td.day-pos { background: #f1f8f4; }
.cal td.day-neg { background: #fbf1ef; }
.cal a.cell { display: block; color: inherit; height: 100%; }
.cal a.cell:hover { text-decoration: none; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login { width: 340px; }
.login .brand { font-size: 18px; margin-bottom: 22px; text-align: center; }
.login .brand span { font-size: 13px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.media-grid figure { margin: 0; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: #fff; }
.media-grid img { width: 100%; border-radius: 4px; display: block; }
.media-grid figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; align-items: end; }
svg.equity { width: 100%; height: auto; background: #fff; }
details summary { cursor: pointer; color: var(--accent); }
pre.raw { white-space: pre-wrap; font-size: 12px; background: #f8f7f4; padding: 8px; border-radius: 6px; max-height: 260px; overflow: auto; }
.progress { height: 8px; background: #eceae5; border-radius: 4px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); }
