:root {
  --bg: #f6f7f9; --card: #fff; --text: #14181f; --muted: #667085; --line: #e4e7ec;
  --accent: #0f766e; --accent-ink: #fff; --up: #15803d; --down: #b42318; --warn-bg: #fff6e0; --warn: #8a5a00;
  --row: #f9fafb;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1116; --card: #161b22; --text: #e6e9ef; --muted: #8b95a5; --line: #262d38; --accent: #2dd4bf; --accent-ink: #04201c;
          --up: #4ade80; --down: #f87171; --warn-bg: #2a2110; --warn: #f5c56b; --row: #1a2029; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
[hidden] { display: none !important; }
header { display: flex; align-items: center; gap: 1.25rem; padding: .6rem 1rem; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { color: var(--accent); font-size: 1.1rem; }
nav { display: flex; gap: .25rem; flex: 1; overflow-x: auto; }
nav a { padding: .35rem .7rem; border-radius: 8px; color: var(--muted); text-decoration: none; white-space: nowrap; }
nav a.active { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-weight: 600; }
main { max-width: 1240px; margin: 0 auto; padding: 1rem 1rem 3rem; }
h1 { font-size: 1.35rem; margin: .25rem 0 1rem; } h2 { font-size: 1.05rem; margin: 1.5rem 0 .5rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; }
.login { max-width: 340px; margin: 18vh auto 0; display: grid; gap: .9rem; }
label { display: grid; gap: .3rem; font-size: .85rem; color: var(--muted); }
input, select { font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); min-width: 0; }
button { font: inherit; padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
button.link { border: 0; background: none; color: var(--muted); }
button.danger { color: var(--down); }
button:disabled { opacity: .5; cursor: default; }
.error { color: var(--down); margin: 0; min-height: 1.2em; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; }
.tile .label { color: var(--muted); font-size: .8rem; } .tile .big { font-size: 1.45rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: .85rem; font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); } .muted { color: var(--muted); }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
table { font-size: .88rem; }
th, td { padding: .45rem .55rem; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
td.l, th.l { text-align: left; }
th { white-space: normal; vertical-align: bottom; line-height: 1.2; font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; background: var(--row); position: sticky; top: 0; }
th[data-sort] { cursor: pointer; user-select: none; }
tbody tr:last-child td { border-bottom: 0; } tbody tr:hover { background: var(--row); }
tfoot td { font-weight: 650; background: var(--row); border-top: 2px solid var(--line); }
td.name { white-space: normal; min-width: 190px; max-width: 280px; }
tr.closed td { color: var(--muted); }
.tag { font-size: .7rem; padding: .1rem .4rem; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.banner { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: .6rem .9rem; margin-bottom: 1rem; font-size: .9rem; }
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; margin-bottom: .75rem; }
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 2rem 1rem; text-align: center; color: var(--muted); }
.drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.result { margin-top: 1rem; display: grid; gap: .4rem; }
.result ul { margin: .2rem 0 0 1.1rem; padding: 0; }
.price-input { width: 7.5rem; text-align: right; }
.sub-note { font-size: .85rem; color: var(--muted); margin: 0 0 .75rem; }
@media (max-width: 640px) { header { gap: .5rem; padding: .5rem; } main { padding: .75rem .6rem 3rem; } .brand { display: none; } }
