:root {
  --bg: #f6f7f9; --panel: #fff; --line: #dfe3e8; --text: #1c2430; --muted: #6b7684;
  --accent: #2456c9; --red: #c62828; --red-bg: #fde7e7; --amber: #a15c00; --amber-bg: #fff1d6;
  --green: #1b6e3a; --green-bg: #e2f4e8; --gray-bg: #eceff3; --edit-bg: #fff8dc;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--accent); }
.muted { color: var(--muted); font-weight: 400; }
.grow { flex: 1; }

.top { display: flex; align-items: center; gap: 24px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 16px; white-space: nowrap; }
.top nav { display: flex; gap: 4px; flex: 1; }
.top nav a { padding: 7px 12px; border-radius: 6px; text-decoration: none; color: var(--text); }
.top nav a:hover { background: var(--gray-bg); }
.top nav a.on { background: var(--accent); color: #fff; }
.who { display: flex; gap: 10px; align-items: center; margin: 0; color: var(--muted); }
button.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit; }
.databar { padding: 6px 20px; background: #fff8dc; border-bottom: 1px solid #ecdca0; font-size: 13px; }
main { padding: 16px 20px 28px; }

.tiles { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; min-width: 150px; }
.tile .v { font-size: 22px; font-weight: 700; line-height: 1.2; }
.tile .l { color: var(--muted); font-size: 12px; }
.tile.red .v { color: var(--red); } .tile.amber .v { color: var(--amber); } .tile.green .v { color: var(--green); }
.tile.click { cursor: pointer; } .tile.click:hover { border-color: var(--accent); }

.toolbar, .params { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 10px; }
.params { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.params label, .inline { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
input[type=number] { width: 72px; }
input[type=search] { width: 280px; }
input[type=number], input[type=search], .login input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: #fff; }
.chk { display: flex; gap: 5px; align-items: center; font-size: 13px; cursor: pointer; white-space: nowrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--panel); }
.seg button { border: 0; background: none; padding: 6px 12px; cursor: pointer; font: inherit; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: #fff; }
.btn, button.primary { display: inline-block; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--text); text-decoration: none; cursor: pointer; font: inherit; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.hint { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; max-width: 1100px; }

#grid { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.tabulator { font-size: 13px; border: 0; background: transparent; }
.tabulator .tabulator-header { border-bottom: 1px solid var(--line); }
.tabulator .tabulator-header .tabulator-col .tabulator-col-content { padding: 6px 6px; }
.tabulator .tabulator-header .tabulator-col { font-size: 12px; }
.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title { white-space: normal; text-overflow: clip; line-height: 1.2; }
.tabulator .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-content .tabulator-col-title { padding-right: 13px; }
.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-sorter { right: 0; }
.tabulator-row .tabulator-cell { padding: 3px 6px; border-right: 1px solid #f0f2f5; }
.tabulator-row.tabulator-row-even { background: #fbfcfd; }
.tabulator-row.tabulator-selectable:hover { background: #eef3fc; cursor: default; }
.tabulator-row .tabulator-cell.edit { background: var(--edit-bg); cursor: text; }
.tabulator-row .tabulator-cell.day { padding: 3px 2px; text-align: center; }
.thumb { width: 30px; height: 40px; object-fit: cover; border-radius: 3px; display: block; background: var(--gray-bg); }
.art { font-weight: 600; } .sub { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.red { background: var(--red-bg); color: var(--red); } .badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.green { background: var(--green-bg); color: var(--green); } .badge.gray { background: var(--gray-bg); color: var(--muted); }
.neg { color: var(--red); } .pos { color: var(--green); } .zero { color: #b6bcc6; }
.cover-red { background: var(--red-bg) !important; color: var(--red); font-weight: 600; }
.cover-amber { background: var(--amber-bg) !important; color: var(--amber); font-weight: 600; }
.strong { font-weight: 700; }

.toast { position: fixed; right: 20px; bottom: 20px; background: #1c2430; color: #fff; padding: 10px 14px; border-radius: 8px; max-width: 420px; z-index: 50; }
.toast.err { background: var(--red); }

.login-page { display: grid; place-items: center; min-height: 100vh; }
.login { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px 28px; width: 320px; display: grid; gap: 12px; }
.login h1 { margin: 0 0 4px; font-size: 20px; }
.login label { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.error { color: var(--red); margin: 0; }

.doc { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 24px 20px; max-width: 900px; }
.doc h1 { font-size: 20px; } .doc h2 { font-size: 16px; margin-top: 22px; }
table.plain { border-collapse: collapse; } table.plain th, table.plain td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
table.plain th { background: var(--gray-bg); }
