:root {
  --bg: #f4f6fa; --panel: #fff; --text: #1c2333; --muted: #6b7488; --line: #e2e6ee;
  --brand: #2f5bea; --brand-d: #2447c0; --ok: #14915a; --warn: #c77b0a; --bad: #d23b3b;
  --side: #111a2e; --side-t: #b8c1d9;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1424; --panel: #172037; --text: #e8ecf6; --muted: #93a0bd; --line: #26314d; --side: #0a0f1d; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, Segoe UI, Roboto, sans-serif; background: var(--bg); color: var(--text); }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 16px; margin: 0 0 12px; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
.layout { display: flex; min-height: 100vh; }
.side { width: 220px; background: var(--side); color: var(--side-t); padding: 16px 10px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; flex-shrink: 0; }
.side .logo { color: #fff; font-weight: 700; font-size: 18px; padding: 4px 10px 14px; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
.side nav a { color: var(--side-t); text-decoration: none; padding: 9px 12px; border-radius: 8px; }
.side nav a:hover { background: #ffffff14; }
.side nav a.active { background: var(--brand); color: #fff; }
.side .me { font-size: 12px; padding: 10px; border-top: 1px solid #ffffff22; }
.side .me b { color: #fff; display: block; }
.main { flex: 1; padding: 24px; min-width: 0; max-width: 1300px; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.head .sp { flex: 1; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.grid { display: grid; gap: 14px; } .g4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); } .g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.kpi .v { font-size: 26px; font-weight: 700; } .kpi .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.btn { background: var(--brand); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer; }
.btn:hover { background: var(--brand-d); }
.btn.sec { background: transparent; color: var(--text); border: 1px solid var(--line); } .btn.sec:hover { background: var(--line); }
.btn.bad { background: var(--bad); } .btn.sm { padding: 4px 9px; font-size: 12px; }
input, select, textarea { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 10px; } label > * { margin-top: 4px; }
.search { max-width: 280px; }
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; background: color-mix(in srgb, var(--panel) 92%, var(--text)); }
tr:last-child td { border-bottom: 0; } td.act { white-space: nowrap; text-align: right; }
.tbl-wrap { overflow-x: auto; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; background: var(--line); }
.b-ok { background: #14915a22; color: var(--ok); } .b-warn { background: #c77b0a22; color: var(--warn); } .b-bad { background: #d23b3b22; color: var(--bad); } .b-info { background: #2f5bea22; color: var(--brand); }
.empty { color: var(--muted); padding: 30px; text-align: center; }
.modal-bg { position: fixed; inset: 0; background: #0009; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; z-index: 10; }
.modal-bg[hidden], .toast[hidden] { display: none; }
.modal { background: var(--panel); border-radius: 14px; padding: 22px; width: 100%; max-width: 560px; }
.modal.wide { max-width: 820px; }
.modal .row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; } .modal .row .full { grid-column: 1 / -1; }
.modal .foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 20; }
.toast.err { background: var(--bad); color: #fff; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; padding: 28px; }
.login h1 { margin-bottom: 4px; } .login p { color: var(--muted); margin: 0 0 18px; }
.err { color: var(--bad); margin: 8px 0; min-height: 1em; }
.kanban { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; padding-bottom: 10px; }
.col { background: color-mix(in srgb, var(--panel) 80%, var(--bg)); border: 1px solid var(--line); border-radius: 12px; min-width: 250px; width: 250px; padding: 10px; flex-shrink: 0; }
.col h3 { font-size: 13px; margin: 2px 4px 8px; display: flex; justify-content: space-between; }
.col .sum { color: var(--muted); font-size: 12px; margin: 0 4px 8px; }
.col.over { outline: 2px dashed var(--brand); }
.opp { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 10px; margin-bottom: 8px; cursor: grab; }
.opp b { display: block; } .opp small { color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding-top: 10px; }
.bars .b { flex: 1; text-align: center; font-size: 11px; color: var(--muted); display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.bars .b i { display: block; background: var(--brand); border-radius: 5px 5px 0 0; min-height: 2px; }
.hbar { margin: 8px 0; font-size: 13px; } .hbar .t { height: 8px; background: var(--line); border-radius: 4px; margin-top: 3px; } .hbar .t i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.items td, .items th { padding: 6px; } .items input { padding: 5px 7px; }
.muted { color: var(--muted); } .right { text-align: right; } .tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.mnav { display: none; }
@media (max-width: 800px) {
  .layout { flex-direction: column; } .side { width: 100%; height: auto; position: static; }
  .side nav { flex-direction: row; flex-wrap: wrap; } .main { padding: 14px; } .modal .row { grid-template-columns: 1fr; }
}

.rb { background: var(--bad); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; margin-left: 8px; }
.cal { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); }
.cal .wd, .cal .days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal .wd div { padding: 8px; text-align: center; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); }
.cal .day { min-height: 96px; padding: 4px 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; overflow: hidden; }
.cal .day:nth-child(7n) { border-right: 0; } .cal .day:hover { background: color-mix(in srgb, var(--panel) 90%, var(--brand)); }
.cal .day.out { opacity: .45; } .cal .day.today .dn { background: var(--brand); color: #fff; border-radius: 99px; display: inline-block; min-width: 22px; text-align: center; }
.cal .dn { font-size: 12px; margin-bottom: 3px; }
.cal .ev { font-size: 11px; padding: 2px 5px; border-radius: 5px; margin-bottom: 2px; background: #2f5bea22; color: var(--brand); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .ev.done { background: #14915a22; color: var(--ok); } .cal .ev.canceled { background: #d23b3b22; color: var(--bad); text-decoration: line-through; } .cal .ev.no_show { background: #c77b0a22; color: var(--warn); }
input[type=color] { padding: 2px; height: 38px; cursor: pointer; }
@media (max-width: 800px) { .cal .day { min-height: 64px; } .cal .ev { font-size: 10px; } }
