:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #1b1f24; --muted: #667085; --line: #e4e7ec;
  --accent: #0f6e56; --accent-ink: #ffffff; --warn: #b54708; --err: #b42318; --ok: #067647; --chip: #eef2f6;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111418; --panel: #191d23; --ink: #e8eaed; --muted: #98a2b3; --line: #2b313a; --accent: #3ccf9e; --accent-ink: #0b1210; --chip: #232932; color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); }
.hidden { display: none !important; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h2 { font-size: 1.25rem; } h3 { font-size: 1rem; margin-top: 1rem; }
.muted { color: var(--muted); } .err { color: var(--err); } .ok { color: var(--ok); } .warn { color: var(--warn); }
.small { font-size: .85rem; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { width: 100%; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
label { display: block; font-size: .85rem; color: var(--muted); }
label > input, label > select, label > textarea { margin-top: .25rem; color: var(--ink); }
button { padding: .55rem .9rem; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-ink); cursor: pointer; font-weight: 600; }
button:disabled { opacity: .5; cursor: wait; }
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); font-weight: 500; }
button.danger { background: var(--err); color: #fff; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .75rem; align-items: end; }
.grid .wide { grid-column: 1 / -1; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.pill { display: inline-block; padding: .1rem .5rem; border-radius: 99px; background: var(--chip); font-size: .75rem; font-weight: 600; color: var(--muted); }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.err { color: var(--err); }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(360px, 100%); display: grid; gap: .75rem; }
.app { display: grid; grid-template-columns: 270px 1fr; min-height: 100vh; }
aside { border-right: 1px solid var(--line); background: var(--panel); padding: 1rem; display: flex; flex-direction: column; gap: .6rem; position: sticky; top: 0; height: 100vh; overflow: auto; }
.brand { font-weight: 700; font-size: 1.1rem; display: flex; justify-content: space-between; align-items: center; }
nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
nav a { display: block; padding: .5rem .6rem; border-radius: 8px; color: inherit; text-decoration: none; }
nav a:hover, nav a.active { background: var(--chip); }
nav a small { display: block; color: var(--muted); font-size: .75rem; }
main { padding: 1.25rem; max-width: 1100px; width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.drop { border: 1px dashed var(--line); border-radius: 10px; padding: .8rem; margin-bottom: .75rem; }
pre.summary { white-space: pre-wrap; background: var(--chip); padding: .8rem; border-radius: 8px; font: 13px/1.5 ui-monospace, Consolas, monospace; }
.items .item { display: grid; grid-template-columns: 3fr .7fr 1fr 1fr .8fr .8fr auto; gap: .4rem; align-items: end; margin-bottom: .4rem; }
.vault { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .75rem; }
.vault .card { margin: 0; }
.tabs { display: flex; gap: .25rem; margin-top: .75rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs a { padding: .45rem .8rem; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--ink); border-color: var(--accent); font-weight: 600; }
.navtop { display: block; padding: .5rem .6rem; border-radius: 8px; color: inherit; text-decoration: none; font-weight: 600; }
.navtop:hover { background: var(--chip); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stats .stat { margin: 0; display: flex; flex-direction: column; gap: .2rem; }
.stats .stat b { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.stats .stat span { color: var(--muted); font-size: .85rem; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
td.strong { font-weight: 700; }
a { color: var(--accent); }
details summary { cursor: pointer; color: var(--muted); margin: .5rem 0; }
@media (max-width: 760px) { .cols { grid-template-columns: 1fr; } }
.toast { position: fixed; right: 16px; bottom: 16px; background: var(--ink); color: var(--bg); padding: .7rem 1rem; border-radius: 10px; max-width: 420px; z-index: 9; }
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  aside { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  nav { max-height: 30vh; }
  main { padding: 16px; }
  .items .item { grid-template-columns: 1fr 1fr; }
  .items .item > :first-child { grid-column: 1 / -1; }
  table { display: block; overflow-x: auto; }
}
