:root {
  --bg: #f4f6f9; --card: #fff; --ink: #1a2433; --muted: #6b7686; --line: #e3e7ee;
  --brand: #1f3a5f; --brand-2: #2d5a8f; --accent: #e8a317; --hot: #c7362c; --warm: #b8730a; --ok: #1e7b4c;
  --radius: 12px; --shadow: 0 1px 2px rgba(20,30,50,.06), 0 1px 8px rgba(20,30,50,.04);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11161d; --card: #19202a; --ink: #e6ebf2; --muted: #93a0b2; --line: #2a3340;
    --brand: #8fb4e8; --brand-2: #a9c6ef; --shadow: none; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink); }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
.muted { color: var(--muted); } .small { font-size: 13px; }
code, pre { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; font-size: 13px; }
pre { padding: 10px; white-space: pre-wrap; word-break: break-all; }

/* шапка */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 18px; padding: 10px 20px;
  padding-top: max(10px, env(safe-area-inset-top)); background: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .top { background: #172235; } }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; font-size: 17px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.top nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.top nav a { color: rgba(255,255,255,.82); padding: 7px 12px; border-radius: 8px; white-space: nowrap; font-weight: 500; }
.top nav a:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.top nav a.on { background: rgba(255,255,255,.18); color: #fff; }
main { max-width: 1240px; margin: 0 auto; padding: 18px 20px 60px; }
main.center { min-height: 100vh; display: grid; place-items: center; }
.ptitle { font-size: 24px; margin: 6px 0 14px; }

/* кнопки и поля */
button, .btn, input, select, textarea { font: inherit; color: inherit; }
button, .btn { display: inline-flex; align-items: center; gap: 6px; justify-content: center; border: 1px solid var(--line);
  background: var(--card); padding: 8px 14px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
button:hover, .btn:hover { border-color: var(--brand-2); text-decoration: none; }
.primary, button.primary, .btn.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; font-weight: 600; }
@media (prefers-color-scheme: dark) { .primary, .btn.primary { background: #2d5a8f; border-color: #2d5a8f; } }
.ghost { background: transparent; }
.btn.on { border-color: var(--ok); color: var(--ok); }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand-2) 35%, transparent); border-color: var(--brand-2); }
input[type=checkbox] { width: auto; margin: 0; accent-color: var(--brand-2); }

/* поиск */
.searchbar { display: flex; gap: 8px; margin-bottom: 14px; }
.searchbar input { font-size: 17px; padding: 12px 14px; box-shadow: var(--shadow); }
.searchbar button { padding: 0 22px; font-size: 16px; }
.layout { display: grid; grid-template-columns: 270px 1fr; gap: 18px; align-items: start; }
.filters { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow: auto; }
.filters > summary { padding: 12px 14px; font-weight: 600; cursor: pointer; list-style: none; }
.filters > summary::-webkit-details-marker { display: none; }
.filters > summary::after { content: "▾"; float: right; color: var(--muted); }
.filters .count { background: var(--brand-2); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 12px; }
.fbody { padding: 0 14px 14px; }
@media (min-width: 901px) { .filters:not([open]) > .fbody { display: block; } .filters > summary { pointer-events: none; } .filters > summary::after { content: ""; } }
fieldset { border: 0; border-top: 1px solid var(--line); margin: 10px 0 0; padding: 10px 0 0; }
legend { font-weight: 600; font-size: 13px; color: var(--muted); padding: 0; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .03em; }
.chk { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.fl { display: block; font-size: 13px; color: var(--muted); margin: 6px 0; }
.fl input, .fl select { margin-top: 4px; color: var(--ink); font-size: 15px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.regions { max-height: 210px; overflow: auto; }
.hint { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.factions { display: flex; gap: 8px; margin-top: 14px; }
.factions .primary { flex: 1; }

/* список */
.rhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.rtools { display: flex; gap: 8px; flex-wrap: wrap; }
.rtools select { width: auto; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 16px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 13px 16px; box-shadow: var(--shadow); }
.item.st-skip { opacity: .55; }
.item.st-work { border-left: 4px solid var(--brand-2); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.title { font-weight: 600; font-size: 15.5px; color: var(--ink); display: block; }
a.title:hover { color: var(--brand-2); }
.org { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.org.big { font-size: 15px; }
.iside { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 190px; }
.sum { font-weight: 700; font-size: 16px; white-space: nowrap; }
.dl { font-size: 13px; color: var(--muted); white-space: nowrap; }
.dl.hot { color: var(--hot); font-weight: 600; } .dl.warm { color: var(--warm); } .dl.closed { text-decoration: line-through; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: #e8edf5; color: #2d4a70; }
.badge.m-zcp { background: #fff1d6; color: #8a5a00; }
.badge.m-auction { background: #fde4e1; color: #9b2a20; }
.badge.m-tender, .badge.m-konkurs { background: #e3f0ff; color: #1f4f8f; }
@media (prefers-color-scheme: dark) { .badge { background: #26354a; color: #b9cdea; } .badge.m-zcp { background: #4a3a14; color: #ffd27a; } .badge.m-auction { background: #4a2420; color: #ffb3aa; } }
.sbadge { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); color: var(--ink); }
.s-work { border-color: var(--brand-2); color: var(--brand-2); } .s-submitted { border-color: #7a4fc2; color: #7a4fc2; }
.s-won { border-color: var(--ok); color: var(--ok); } .s-lost, .s-skip { color: var(--muted); }
.acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.acts button { padding: 5px 10px; font-size: 13px; }
.acts button.on { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.iside .acts span { display: none; }
.empty { background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 16px; }

/* карточка */
.back { display: inline-block; margin-bottom: 10px; }
.tender { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.tender h1 { font-size: 22px; margin-top: 4px; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 16px 0; }
.facts > div { background: var(--card); padding: 10px 12px; }
.facts span { display: block; font-size: 12px; color: var(--muted); }
.facts b { font-weight: 600; }
.cta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.tip { font-size: 13.5px; color: var(--warm); }
.box { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.box h2 { font-size: 17px; }
.tender .acts { justify-content: flex-start; }
.note { margin-top: 12px; display: grid; gap: 8px; justify-items: start; }
.lots { display: grid; gap: 10px; }
.lot { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.lhead { display: flex; justify-content: space-between; gap: 12px; }
.lmeta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.ldesc summary { cursor: pointer; color: var(--brand-2); font-size: 13.5px; margin-top: 6px; }
.ldesc p { white-space: pre-wrap; font-size: 14px; margin: 6px 0 0; }

/* мои тендеры */
.board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: start; }
.col { background: color-mix(in srgb, var(--line) 45%, transparent); border-radius: var(--radius); padding: 10px; }
.col h2 { font-size: 15px; display: flex; gap: 8px; align-items: center; }
.bcard { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; color: var(--ink); box-shadow: var(--shadow); }
.bcard:hover { border-color: var(--brand-2); text-decoration: none; }
.bcard .title { font-size: 14px; margin: 4px 0; }
.bcard .sum { font-size: 14px; }
.bnote { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* поиски, настройки */
.slist { list-style: none; padding: 0; display: grid; gap: 8px; }
.slist li { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.slist form { display: inline; }
section.box:first-of-type { border-top: 0; }
main > section.box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-top: 14px; }
.inline { margin: 8px 0; }
.kv td { padding: 4px 16px 4px 0; vertical-align: top; } .kv td:first-child { color: var(--muted); white-space: nowrap; }
.pw { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; } .pw input { max-width: 260px; }
.flash { background: #e8f4ec; border: 1px solid #b9dcc6; color: #1e5c3a; padding: 10px 14px; border-radius: 10px; margin-bottom: 10px; }
.flash.err { background: #fdecea; border-color: #f2c0bb; color: #8f2a20; }

/* вход */
.auth { width: min(360px, 92vw); background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: grid; gap: 12px; text-align: center; box-shadow: var(--shadow); }
.auth img { margin: 0 auto; }

dialog { border: 1px solid var(--line); border-radius: 14px; padding: 20px; width: min(440px, 92vw); background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(10,20,35,.45); }
dialog form { display: grid; gap: 10px; }

/* телефон */
@media (max-width: 900px) {
  main { padding: 12px 12px 90px; }
  .top { gap: 10px; padding: 8px 12px; }
  .brand span { display: inline; }
  .top nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--brand); justify-content: space-around;
    padding: 6px 4px max(6px, env(safe-area-inset-bottom)); gap: 0; box-shadow: 0 -1px 6px rgba(0,0,0,.15); }
  .top nav a { flex: 1; text-align: center; font-size: 13px; padding: 8px 2px; }
  main { padding-bottom: 90px; }
  .layout { grid-template-columns: 1fr; }
  .filters { position: static; max-height: none; }
  .item { grid-template-columns: 1fr; gap: 8px; padding: 12px; }
  .iside { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; text-align: left; min-width: 0; }
  .iside .acts { width: 100%; justify-content: flex-start; }
  .iside .acts span { display: inline; }
  .facts { grid-template-columns: 1fr 1fr; }
  .board { grid-template-columns: 1fr; }
  .tender { padding: 16px; }
  .slist li { flex-direction: column; align-items: flex-start; }
  .searchbar button { padding: 0 14px; }
}

/* конкуренты и цены */
.mtabs { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; margin-bottom: 14px; }
.mtabs button { border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; font-weight: 600; color: var(--muted); }
.mtabs button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.mtabs em { font-style: normal; font-weight: 500; font-size: 12px; color: var(--muted); margin-left: 4px; }
.mstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.mstats > div { background: var(--bg); border-radius: 10px; padding: 12px 14px; }
.mstats span { display: block; font-size: 12.5px; color: var(--muted); }
.mstats b { display: block; font-size: 19px; margin-top: 2px; }
.mstats small { display: block; font-size: 12px; color: var(--muted); }
.mstats .up b { color: var(--ok); } .mstats .down b { color: var(--warm); }
.mpanel h4 { font-size: 14px; margin: 0 0 8px; }
.mtop { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 10px; }
.mtop li { display: grid; grid-template-columns: 1fr 120px; grid-template-areas: "name sum" "bar bar"; gap: 4px 12px; }
.mname { grid-area: name; display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.mname span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mname b { font-size: 13px; color: var(--brand-2); white-space: nowrap; }
.msum { grid-area: sum; text-align: right; font-size: 13px; color: var(--muted); white-space: nowrap; }
.mbar { grid-area: bar; height: 6px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.mbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-2), #4f86c6); border-radius: 4px; }
.mlist summary { cursor: pointer; color: var(--brand-2); font-weight: 600; font-size: 14px; padding: 6px 0; }
.mlist ul { list-style: none; padding: 0; margin: 6px 0 0; border: 1px solid var(--line); border-radius: 10px; }
.mlist li { display: flex; justify-content: space-between; gap: 14px; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.mlist li:last-child { border-bottom: 0; }
.mlist li > div { display: grid; gap: 2px; min-width: 0; }
.mlist .muted { font-size: 12.5px; }
.mempty { background: var(--bg); border-radius: 10px; padding: 14px; color: var(--muted); margin: 0; }
.r { text-align: right; } .nw { white-space: nowrap; }
@media (max-width: 900px) { .mtabs em { display: none; } .mtabs button { padding: 7px 8px; } .mtop li { grid-template-columns: 1fr; grid-template-areas: "name" "bar" "sum"; } .msum { text-align: left; } .mtabs { display: flex; } .mtabs button { flex: 1; } }
