:root {
  /* графит и латунь */
  --bg: #111312; --panel: #181b1a; --panel2: #1f2321; --line: #2b2f2d;
  --text: #e7e4da; --muted: #8e918a; --brass: #d4a53f; --ok: #86b894; --bad: #e0654b;
  --cell-off: #262a28;
  /* бумага самописца для графиков */
  --paper: #e6eae7; --ink: #1b1f1d; --paper-muted: #5f6a64; --paper-grid: #c6cfc9;
  --c-quest: #2b5f5c; --c-tour: #c4861a; --c-duel: #86402f; --c-rest: #b9c2bc;
  /* свои шрифты не грузим (каждый — лишний запрос к чужому серверу): берётся системный */
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Roboto Mono", monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.muted { color: var(--muted); font-size: 13px; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* верхняя строка */
.top { position: sticky; top: 0; z-index: 30; background: var(--bg); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; gap: 28px; padding: 0 32px; height: 52px; max-width: 1280px; margin: 0 auto; }
.name { font-weight: 600; font-size: 17px; text-decoration: none; letter-spacing: .01em; white-space: nowrap; }
.name span { color: var(--muted); font-weight: 400; margin-left: 8px; }
#nav { display: flex; gap: 4px; height: 100%; overflow-x: auto; scrollbar-width: none; }
#nav::-webkit-scrollbar { display: none; }
#nav a { display: flex; align-items: center; gap: 7px; padding: 0 12px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
#nav a:hover { color: var(--text); }
#nav a.on { color: var(--text); border-bottom-color: var(--brass); }
#nav a.soon { opacity: .5; }
.count { background: var(--brass); color: #1c1606; font: 600 12px/1 var(--mono); padding: 3px 6px; }
.conn { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.conn .stamp { font-family: var(--mono); font-size: 12px; }
.sq { width: 8px; height: 8px; background: var(--muted); flex: none; }
.conn.ok .sq, .live.on .sq { background: var(--ok); } .conn.bad .sq { background: var(--bad); }

.decision-banner { background: var(--brass); color: #1c1606; padding: 10px 32px; display: flex; gap: 8px 18px; align-items: baseline; flex-wrap: wrap; }
.decision-banner b { font-weight: 600; }
.decision-banner .q { flex: 1 1 300px; }
.decision-banner a { font-weight: 600; text-underline-offset: 3px; }

/* разделы */
main { padding: 8px 32px 80px; max-width: 1280px; margin: 0 auto; }
.sec { padding-top: 40px; }
.daybar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding-top: 22px; }
.daybar .lbl { font-weight: 600; margin-right: 4px; }
.daybar select { background: var(--panel2); border: 1px solid var(--line); color: var(--text); padding: 8px 10px; border-radius: 2px; font: inherit; min-width: 180px; }
.daybar .btn { min-width: 40px; }
.rob { margin-top: 12px; font-size: 13px; color: var(--muted); }
.rob b { color: var(--text); font-weight: 600; }
.sec-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 20px; margin-bottom: 16px; }
.sec-head h2 { font-size: 22px; font-weight: 600; letter-spacing: -.005em; margin-right: auto; }
.sub { color: var(--muted); font-size: 13px; }
.tabs { display: inline-flex; gap: 18px; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 2px 0; font-size: 14px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--brass); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); gap: 20px; }
.grid2 > * { min-width: 0; }

/* аккаунт */
.acct { background: var(--panel); padding: 24px 26px 26px; border-radius: 2px; }
.acct-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; }
.acct-head h3 { font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
.acct-head .where { color: var(--muted); font-size: 13px; }
.state { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.state .sq { width: 9px; height: 9px; }
.state.on .sq { background: var(--ok); } .state.warn .sq { background: var(--brass); } .state.off .sq { background: var(--muted); }
.doing { margin: 10px 0 22px; font: 12.5px/1.4 var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px 18px; margin-bottom: 26px; }
.kpi .v { font: 500 28px/1.1 var(--mono); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 13px; color: var(--muted); margin-top: 3px; }
.kpi .d { font: 12px var(--mono); color: var(--ok); margin-top: 1px; }

/* ползунки из квадратов */
.goal { margin-top: 18px; }
.goal-top { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 14px; flex-wrap: wrap; font-size: 14px; }
.goal-top b { font-weight: 500; }
.goal-top span { color: var(--muted); font: 12.5px var(--mono); }
.cells { display: grid; grid-template-columns: repeat(30, 1fr); gap: 2px; margin: 8px 0 5px; }
.cells i { aspect-ratio: 1; background: var(--cell-off); }
.cells i.r { background: #3b2a25; }
.cells i.f { background: var(--brass); }
.cells i.h { background: linear-gradient(90deg, var(--brass) var(--p), var(--cell-off) var(--p)); }
.cells i.h.r { background: linear-gradient(90deg, var(--brass) var(--p), #3b2a25 var(--p)); }
.goal-sub { font-size: 12.5px; color: var(--muted); }
.goal-sub .ends { display: flex; justify-content: space-between; gap: 12px; font: 12px var(--mono); }
.incs { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 13px; color: var(--muted); }
.incs b { color: var(--text); font: 500 13px var(--mono); margin-right: 5px; }

/* графики на бумаге самописца */
.stack { display: grid; gap: 20px; }
.chart { background: var(--paper); color: var(--ink); padding: 20px 22px 18px; border-radius: 2px;
  background-image: linear-gradient(#1b1f1d0d 1px, transparent 1px), linear-gradient(90deg, #1b1f1d0d 1px, transparent 1px); background-size: 10px 10px; }
.chart h3 { font-size: 16px; font-weight: 600; }
.chart .sub { color: var(--paper-muted); margin: 2px 0 12px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--mono); fill: var(--paper-muted); font-size: 11px; }
.chart .val { fill: var(--ink); font-weight: 500; }
.hks { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px 20px; }
.hk .v { font: 500 24px/1.1 var(--mono); letter-spacing: -.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.hk .l { font-size: 13px; color: var(--paper-muted); margin-top: 3px; }
.hk .d { font: 12px var(--mono); color: var(--paper-muted); margin-top: 1px; }
.hfc { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--paper-grid); font-size: 14px; }
.chart td.hbar { position: relative; z-index: 0; min-width: 110px; }
.chart td.hbar span { position: absolute; right: 0; top: 7px; bottom: 7px; background: #cfe0dd; z-index: -1; }

#histBody table td:not(:first-child), #histBody table th { white-space: nowrap; padding-left: 10px; }
.sec-head .tabs { flex-wrap: wrap; max-width: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 12.5px; color: var(--paper-muted); margin-top: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; }
.chart table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.chart td, .chart th { padding: 6px 8px 6px 0; text-align: left; border-bottom: 1px solid var(--paper-grid); }
.chart td:first-child, .chart td.r { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.chart th { color: var(--paper-muted); font-weight: 400; font-size: 12.5px; }
.chart td.r, .chart th.r { text-align: right; padding-right: 0; }

/* лента дня: обе строки на одной оси времени */
.tape { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px 14px; align-items: center; }
.tape .who { font-size: 14px; font-weight: 500; }
.track { position: relative; height: 26px; background: #1b1f1d12; min-width: 0; }
.track .segs { position: absolute; inset: 0; overflow: hidden; }
.track span { position: absolute; top: 0; bottom: 0; }
.track i { position: absolute; bottom: -7px; width: 2px; height: 7px; margin-left: -1px; }
.track .hr { position: absolute; top: 0; bottom: 0; width: 1px; background: #e6eae7; opacity: .7; }
.tape-axis { position: relative; height: 16px; }
.tape-axis span { position: absolute; transform: translateX(-50%); font: 11px var(--mono); color: var(--paper-muted); }
.tape-axis span.first { transform: none; }
.tape-axis span.last { transform: translateX(-100%); }
.now-line { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); }

/* журнал */
.jbox { background: #0b0d0c; border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.jbar { display: flex; align-items: center; gap: 18px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.live { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.jbar .chk { margin-left: auto; color: var(--muted); font-size: 13px; display: flex; gap: 8px; align-items: center; }
.chk input { accent-color: var(--brass); }
.jlines { height: 480px; overflow-y: auto; padding: 8px 0; font: 12.5px/1.6 var(--mono); }
.jl { display: grid; grid-template-columns: 50px 1fr; gap: 12px; padding: 0 16px; }
.jl:hover { background: #ffffff08; }
.jl time { color: #5c615d; }
.jl span { white-space: pre-wrap; word-break: break-word; color: #c3c2b8; }
.jl.win span { color: var(--ok); } .jl.loss span, .jl.bad span { color: var(--bad); } .jl.warn span { color: var(--brass); }
.jl.block span { color: var(--text); font-weight: 600; } .jl.sum span { color: var(--text); font-weight: 500; } .jl.profile span { color: #a9b8c4; } .jl.start span { color: var(--text); } .jl.dim span { color: #5c615d; }
.jl.new { animation: fresh 1.2s ease-out; }
@keyframes fresh { from { background: #d4a53f2e; } to { background: transparent; } }

/* решения */
.dec { display: grid; gap: 12px; max-width: 820px; }
.dec .item { background: var(--panel); padding: 16px 20px; border-radius: 2px; border-left: 3px solid var(--line); }
.dec .item.pend { border-left-color: var(--brass); }
.dec .head { display: flex; gap: 6px 14px; align-items: baseline; flex-wrap: wrap; }
.dec .head b { font-weight: 600; }
.dec .head .t { font: 12px var(--mono); color: var(--muted); }
.dec .head .s { margin-left: auto; font-size: 13px; color: var(--muted); }
.dec .item.pend .s { color: var(--brass); }
.dec p { margin-top: 6px; }
.dec .opts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.dec .opts button { background: none; border: 1px solid var(--line); padding: 6px 14px; border-radius: 2px; color: var(--muted); cursor: not-allowed; }
.dec .opts button:not(:disabled) { color: var(--text); border-color: var(--brass); cursor: pointer; }
.dec .opts button:not(:disabled):hover { background: var(--brass); color: #1c1606; }
.empty { color: var(--muted); padding: 8px 0; }
.note { max-width: 620px; display: grid; gap: 10px; }

/* пульт */
.ctl .acct-head { margin-bottom: 4px; }
.ctl .line { color: var(--muted); font-size: 13.5px; margin-top: 6px; }
.ctl .line code { font: 12.5px var(--mono); color: var(--text); }
.ctl h4 { margin: 22px 0 8px; font-size: 13px; font-weight: 500; color: var(--muted); }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { background: var(--panel2); border: 1px solid var(--line); padding: 8px 14px; border-radius: 2px; color: var(--text); font-size: 14px; }
.btn:hover:not(:disabled) { border-color: var(--brass); }
.btn.main { background: #2a2618; border-color: #5a4a1c; }
.btn.danger { color: var(--bad); }
.btn.danger.sure { background: var(--bad); color: #1c0a06; border-color: var(--bad); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.row { display: flex; gap: 8px; margin-top: 8px; }
.txt { flex: 1; min-width: 0; background: #0b0d0c; border: 1px solid var(--line); border-radius: 2px; padding: 8px 10px; color: var(--text); font: 13px var(--mono); }
.txt:focus { outline: 2px solid var(--brass); outline-offset: -1px; }
.sch { margin-top: 6px; display: grid; gap: 2px; }
.sch div { display: flex; align-items: baseline; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.sch time { font: 13px var(--mono); color: var(--muted); min-width: 108px; }
.sch button { margin-left: auto; background: none; border: 0; color: var(--muted); padding: 0 4px; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.sch button:hover { color: var(--bad); }
.dec-box { margin-top: 18px; padding: 12px 14px; border-left: 3px solid var(--brass); background: #1f1b0d; }
.dec-box p { margin: 0 0 10px; }
#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 50; max-width: min(520px, calc(100vw - 32px)); background: var(--text); color: #111312; padding: 10px 16px; border-radius: 2px; font-size: 14px; box-shadow: 0 6px 24px #0008; }
#toast.bad { background: var(--bad); color: #1c0a06; }

/* вход */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 24px 16px; }
.login { width: min(380px, 100%); display: grid; gap: 22px; padding: 0; }
.login .name { font-size: 20px; }
.login form { display: grid; gap: 14px; background: var(--panel); padding: 26px; border-radius: 2px; }
.login h1 { font-size: 22px; font-weight: 600; }
.login label { display: grid; gap: 6px; font-size: 13.5px; color: var(--muted); }
.login .txt { font-size: 15px; padding: 10px 12px; }
.login .btn { padding: 11px; font-weight: 500; }
.note-line { min-height: 1.4em; font-size: 14px; color: var(--muted); }
.note-line.bad { color: var(--bad); }

/* люди и профиль */
.card { background: var(--panel); padding: 20px 22px; border-radius: 2px; }
.me { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.me a { color: var(--text); text-decoration: none; }
.me a:hover { text-decoration: underline; text-underline-offset: 3px; }
.me button { background: none; border: 0; color: var(--text); text-decoration: underline; text-underline-offset: 3px; padding: 0; font-size: 13px; }
.people { width: 100%; border-collapse: collapse; font-size: 14px; }
.people th, .people td { text-align: left; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); vertical-align: baseline; }
.people th { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.people .num { font-size: 12.5px; color: var(--muted); }
.form { display: grid; gap: 10px; max-width: 520px; }
.form label { display: grid; gap: 5px; font-size: 13.5px; color: var(--muted); }
.form .checks { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--text); font-size: 14px; }
.form .checks label { display: flex; gap: 6px; align-items: center; color: var(--text); }
.form select { background: #0b0d0c; border: 1px solid var(--line); color: var(--text); padding: 8px 10px; border-radius: 2px; font: inherit; }
.invite-link { margin-top: 10px; padding: 10px 12px; background: #0b0d0c; border-left: 3px solid var(--brass); font: 12.5px var(--mono); word-break: break-all; }
.secret { font: 500 16px var(--mono); letter-spacing: .04em; margin: 8px 0; word-break: break-all; }

@media (max-width: 860px) {
  .bar { padding: 0 16px; gap: 14px; }
  .name span, .conn .stamp, #connText { display: none; }
  .conn { margin-left: 0; }
  main { padding: 0 16px 64px; }
  .decision-banner { padding: 10px 16px; }
  .sec { padding-top: 30px; }
  .acct { padding: 20px 18px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi .v { font-size: 24px; }
  .tape { grid-template-columns: 1fr; gap: 4px; }
  .tape .who { margin-top: 8px; }
  .tape-pad { display: none; }
  .tape { padding: 0 16px; }
  .row { flex-wrap: wrap; }
  .row .txt { flex: 1 1 100%; }
  .jl { grid-template-columns: 42px 1fr; gap: 8px; padding: 0 10px; }
  .jlines { height: 400px; }
  .chart { overflow-x: auto; padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .jl.new { animation: none; } }
