/* Цвета и шапка — как у плана продаж (plan.service, planner/static/app.css) */
:root {
  --bg: #f6f7f9; --panel: #ffffff; --text: #1d2330; --muted: #6b7280; --line: #e3e6eb; --line2: #d3d8df;
  --accent: #2f6fde; --accent-soft: #e8f0fd; --err: #c62828; --err-soft: #fdecec; --head: #eef1f5; --set: #fff1b3;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14171c; --panel: #1c2027; --text: #e6e8ec; --muted: #9aa2ad; --line: #2c323b; --line2: #39404b;
    --accent: #6c9cf0; --accent-soft: #1f2b40; --err: #ff7b7b; --err-soft: #3a1f22; --head: #232831; --set: #403718;
  }
}
:root[data-theme="dark"] {
  --bg: #14171c; --panel: #1c2027; --text: #e6e8ec; --muted: #9aa2ad; --line: #2c323b; --line2: #39404b;
  --accent: #6c9cf0; --accent-soft: #1f2b40; --err: #ff7b7b; --err-soft: #3a1f22; --head: #232831; --set: #403718;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 13px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

.sticky-head { position: sticky; top: 0; z-index: 30; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.topbar { display: flex; align-items: center; gap: 16px; padding: 8px 16px; background: var(--panel);
  border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 650; font-size: 15px; }
.tabs { display: flex; gap: 4px; }
.tabs button { border: 0; background: none; padding: 6px 12px; border-radius: 6px; cursor: pointer; color: var(--muted); }
.tabs button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.topinfo { color: var(--muted); margin-left: auto; }
.user a { margin-left: 8px; }
.theme-btn { margin-left: 8px; border: 1px solid var(--line2); background: var(--panel); border-radius: 14px;
  padding: 1px 8px; cursor: pointer; }
.theme-btn:hover { background: var(--accent-soft); }

.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; padding: 10px 16px;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.filters label { display: flex; flex-direction: column; gap: 2px; color: var(--muted); font-size: 12px; }
.filters label.grow { flex: 1 1 200px; }
.filters label.set input, .filters label.set select { background: var(--set); }
select, input[type="text"], input[type="password"], input:not([type]) {
  border: 1px solid var(--line2); background: var(--panel); border-radius: 6px; padding: 5px 8px; min-width: 120px; }
main { padding: 12px 16px 40px; }
.btn { border: 1px solid var(--line2); background: var(--panel); border-radius: 6px; padding: 5px 12px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

.dep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; align-items: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.card h3 { margin: 0 0 8px; font-size: 14px; display: flex; gap: 10px; align-items: baseline; justify-content: space-between; }
.card h3 .muted { font-weight: 400; font-size: 12px; white-space: nowrap; }
.dep-list { list-style: none; margin: 0; padding: 0; }
.dep-list li { padding: 4px 0; border-top: 1px solid var(--line); }
.dep-list li:first-child { border-top: 0; }

.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
table.list { border-collapse: collapse; width: 100%; }
table.list th, table.list td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.list th { background: var(--head); font-weight: 600; position: sticky; top: 0; white-space: nowrap; }
table.list tbody tr:hover td { background: var(--accent-soft); }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--accent); }
th.sortable[data-dir]::after { content: " " attr(data-dir); font-size: 10px; }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; width: 100%;
  max-width: 340px; display: flex; flex-direction: column; gap: 12px; }
.login-box h1 { font-size: 18px; margin: 0; }
.login-box p { margin: 0 0 6px; }
.login-box label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.login-box input { width: 100%; }
.login-err { color: var(--err); background: var(--err-soft); padding: 6px 10px; border-radius: 6px; }

@media (max-width: 700px) {
  .topbar { gap: 8px; }
  .topinfo { margin-left: 0; width: 100%; order: 3; }
  .dep-grid { grid-template-columns: 1fr; }
}
