:root {
  --bg: #F4F4F2; --surface: #FFFFFF; --soft: #F1F1EE; --ink: #16161A; --muted: #7A7A80;
  --line: #E4E4E0; --line-2: #ECECE8; --accent: #2B6CF0; --up: #12915A; --down: #D2393B; --star: #FFF6DC;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: 12px; margin: 0 0 10px; }
input, select { font: inherit; color: inherit; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); min-width: 0; }
input:focus, select:focus { outline: 2px solid #C9D9FF; border-color: var(--accent); }
.btn { height: 40px; padding: 0 16px; border-radius: 10px; border: 0; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.soft { background: var(--soft); color: var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }
.card { background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; padding: 18px; min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
h2 { font-size: 16px; margin: 0; }

/* вход */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(360px, 100%); display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login-card h1 { margin: 0; font-size: 20px; }
.login-card p { margin: 0 0 6px; }
.logo { font-size: 28px; }
.err { color: var(--down); margin: 0; }

/* шапка */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; flex-wrap: wrap; }
.top-left { display: flex; flex-direction: column; }
.top-left b { font-size: 17px; }
.top-right { display: flex; gap: 8px; }

#notices { padding: 0 20px; display: flex; flex-direction: column; gap: 10px; }
.notice { padding: 14px 16px; border-radius: 14px; background: #FFF6DC; border: 1px solid #F1DFAE; }
.notice code { background: #fff; padding: 2px 6px; border-radius: 6px; font-size: 13px; }
.notice.err { background: #FDECEC; border-color: #F5C7C7; color: var(--ink); }

.grid { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 16px; padding: 16px 20px 30px; align-items: start; }

/* запросы */
.row-form { display: flex; gap: 8px; margin-bottom: 12px; }
.row-form input { flex: 1; }
.q-list { display: flex; flex-direction: column; gap: 4px; }
.q-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; border: 0; background: transparent; font: inherit; text-align: left; width: 100%; color: inherit; }
.q-item:hover { background: var(--soft); }
.q-item.active { background: #EAF1FF; }
.q-item.off { opacity: .5; }
.q-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-badge { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.q-badge.star { background: var(--star); color: #9A7414; }
.q-tools { display: flex; gap: 2px; }
.icon { width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; color: var(--muted); font-size: 14px; }
.icon:hover { background: #fff; color: var(--ink); }

/* выдача */
.res { width: 100%; border-collapse: collapse; }
.res th { text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line-2); }
.res td { padding: 9px 8px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.res tr:last-child td { border-bottom: 0; }
.res tr.star td { background: var(--star); }
.res tr.cut td { border-bottom: 2px dashed var(--line); }
.pos { font-weight: 700; width: 36px; font-variant-numeric: tabular-nums; }
.delta { width: 56px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.delta.new { color: var(--accent); }
.ttl { font-weight: 600; }
.uname { color: var(--accent); text-decoration: none; font-size: 13px; }
.uname:hover { text-decoration: underline; }
.typ { font-size: 12px; color: var(--muted); white-space: nowrap; }
.empty { color: var(--muted); padding: 20px 4px; }

/* проекты */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 4px 0 10px; border-radius: 999px; background: var(--star); font-weight: 600; font-size: 13px; }
.chip button { width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; color: #9A7414; }
.hist { display: flex; flex-direction: column; gap: 10px; }
.hist-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 10px 12px; border-radius: 12px; background: var(--soft); }
.hist-row b { font-size: 13px; }
.hist-row .muted { font-size: 12px; }
.hist-now { font-size: 18px; font-weight: 700; text-align: right; }
.spark { grid-column: 1 / -1; display: flex; align-items: flex-end; gap: 2px; height: 34px; }
.spark i { flex: 1; min-width: 2px; background: var(--accent); border-radius: 2px 2px 0 0; opacity: .8; }
.spark i.miss { background: var(--line); height: 3px; }

/* лента */
.ch { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.ch:last-child { border-bottom: 0; }
.ch-head { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.ch-head b { color: var(--ink); }
.ch-line { font-size: 13px; }
.ch-line.up { color: var(--up); }
.ch-line.down { color: var(--down); }
.ch-line.new { color: var(--accent); }
.ch-line.gone { color: var(--muted); }

.settings { display: flex; flex-direction: column; gap: 12px; }
.settings label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.account { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-2); font-size: 13px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 50; max-width: 90vw; }
.toast.error { background: var(--down); }

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; padding: 12px; }
  .top, #notices { padding-left: 12px; padding-right: 12px; }
  .typ, .res th:nth-child(4), .res td:nth-child(4) { display: none; }
}

.switch { position: relative; width: 34px; height: 20px; border-radius: 999px; border: 0; background: var(--line); cursor: pointer; padding: 0; margin-right: 2px; }
.switch span { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch.on { background: var(--up); }
.switch.on span { left: 16px; }
.q-tools { align-items: center; }
.proj { padding: 12px 0; border-top: 1px solid var(--line-2); }
.proj-name { display: block; margin-bottom: 6px; }
.ptab { width: 100%; border-collapse: collapse; font-size: 13px; }
.ptab th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 600; padding: 4px 0; }
.ptab td { padding: 5px 0; border-top: 1px solid var(--line-2); }
.ptab th:nth-child(n+2), .ptab td:nth-child(n+2) { text-align: right; width: 64px; }
.pnow { font-weight: 700; }
.proj .small { margin: 6px 0 0; }
