:root {
  --bg: #f4f5f7; --surface: #fff; --ink: #1d2433; --muted: #667085; --line: #e4e7ec;
  --brand: #1f4fd1; --brand-ink: #fff; --ok: #12805c; --warn: #b54708; --danger: #c0322b;
  --chip: #eef2ff; --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { background: #101828; color: #fff; }
.topbar .inner { max-width: 1200px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 16px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: .2px; white-space: nowrap; }
.brand small { font-weight: 500; opacity: .6; margin-left: 6px; }
.env { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: #f79009; color: #101828; margin-left: 8px; vertical-align: middle; }
.env.prod { background: #32d583; }
nav.main { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; justify-content: center; }
nav.main a { color: #d0d5dd; padding: 8px 8px; border-radius: 8px; white-space: nowrap; }
nav.main a:hover { background: #1d2939; text-decoration: none; color: #fff; }
nav.main a.active { background: #344054; color: #fff; }
.who { display: flex; gap: 10px; align-items: center; color: #d0d5dd; font-size: 14px; }
.who button { background: none; border: 1px solid #475467; color: #d0d5dd; border-radius: 8px; padding: 5px 10px; cursor: pointer; }
main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 24px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 28px 0 12px; }
.muted { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 30px; font-weight: 700; margin-top: 4px; }
.stat .sub { font-size: 13px; color: var(--muted); }
.stat .sub b { color: var(--ok); }
.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid; }
.flash.ok { background: #ecfdf3; border-color: #abefc6; color: #05603a; }
.flash.info { background: #eff8ff; border-color: #b2ddff; color: #175cd3; }
.flash.warn { background: #fffaeb; border-color: #fedf89; color: #93370d; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: #fafbfc; }
tr:last-child td { border-bottom: none; }
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; background: var(--surface); }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 7px 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.tabs a.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tabs a:hover { text-decoration: none; }
.count { font-size: 12px; opacity: .7; margin-left: 4px; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--chip); color: #3538cd; white-space: nowrap; }
.badge.NEW { background: #fef0c7; color: #93370d; }
.badge.IN_PROGRESS { background: #eff8ff; color: #175cd3; }
.badge.COMPLETED { background: #ecfdf3; color: #067647; }
.badge.CLOSED_BY_ADMIN { background: #f2f4f7; color: #475467; }
.badge.ADMIN { background: #fde7f3; color: #c11574; }
.badge.BLOCKED { background: #fef3f2; color: #b42318; }
.badge.MANAGER { background: #eef4ff; color: #3538cd; }
form.inline { display: inline; margin: 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 4px; }
input[type=text], input[type=search], input[type=url], input[type=date], select { font: inherit; padding: 8px 10px; border: 1px solid #d0d5dd; border-radius: 8px; background: #fff; min-width: 0; }
input[type=search] { min-width: 260px; }
button, .btn { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); cursor: pointer; display: inline-block; }
button.secondary, .btn.secondary { background: #fff; color: var(--ink); border-color: #d0d5dd; }
button.danger { background: #fff; color: var(--danger); border-color: #fda29b; }
button.small, .btn.small { padding: 4px 10px; font-size: 13px; }
.state { font-size: 13px; margin-right: 8px; }
.state.on { color: var(--ok); }
.state.off { color: var(--muted); }
.btn:hover { text-decoration: none; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 12px; }
.timeline li:last-child { border-bottom: none; }
.timeline time { color: var(--muted); font-size: 13px; min-width: 120px; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.chart { width: 100%; height: 180px; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.login { max-width: 420px; margin: 10vh auto; text-align: center; }
.login .card { padding: 32px; }
.stack > * + * { margin-top: 10px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.section { margin-bottom: 28px; }
.notice { background: #fffaeb; border: 1px solid #fedf89; color: #93370d; border-radius: var(--radius); padding: 12px 16px; }
.who span { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1100px) { .topbar .brand small { display: none; } .who span { display: none; } }
@media (max-width: 640px) {
  .topbar .inner { gap: 8px; padding-top: 8px; }
  .who { margin-left: auto; }
  nav.main { order: 3; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 8px; }
  input[type=search] { min-width: 0; width: 100%; }
  .filters label { width: 100%; }
  dl.kv { grid-template-columns: 1fr; }
}

.filters label.check { flex-direction: row; align-items: center; gap: 6px; }
textarea { font: inherit; padding: 8px 10px; border: 1px solid #d0d5dd; border-radius: 8px; background: #fff; }
.tg-preview { background: #eef3f8; border-radius: 12px; padding: 12px 14px; max-width: 420px; white-space: normal; word-wrap: break-word; }
.tg-preview .tg-button { margin-top: 8px; background: #fff; border-radius: 8px; padding: 7px; text-align: center; font-size: 14px; color: var(--brand); }
.tg-preview .spoiler { background: #c7cbd1; color: transparent; border-radius: 3px; }
.tg-preview blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--brand); }
button[disabled] { opacity: .5; cursor: not-allowed; }

/* Visual editor for Telegram texts (editor.js) */
.rte { border: 1px solid #d0d5dd; border-radius: 8px; background: #fff; overflow: hidden; }
.rte-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-bottom: 1px solid #eaecf0; background: #f9fafb; }
.rte-btn { min-width: 32px; height: 30px; padding: 0 8px; border: 1px solid transparent; border-radius: 6px; background: none; color: #344054; font-size: 14px; cursor: pointer; }
.rte-btn:hover { background: #eef3ff; border-color: #c7d4f8; }
.rte-btn.on { background: #1f4fd1; color: #fff; }
.rte-area { padding: 10px 12px; font-size: 14px; line-height: 1.5; outline: none; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 520px; overflow-y: auto; }
.rte-area a { color: #1f4fd1; text-decoration: underline; }
.rte textarea.rte-code { border: 0; border-radius: 0; width: 100%; font-family: ui-monospace, monospace; font-size: 13px; padding: 10px 12px; min-height: 12em; }

/* Project Nika additions */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.form-col { display: flex; flex-direction: column; gap: 12px; max-width: 720px; }
.form-col label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.form-col label.check { flex-direction: row; align-items: center; gap: 8px; }
.form-col input[type=email], .form-col input[type=password], .form-col input[type=text], .form-col input[type=number], .form-col select, .form-col textarea { width: 100%; }
input[type=email], input[type=password], input[type=number] { font: inherit; padding: 8px 10px; border: 1px solid #d0d5dd; border-radius: 8px; background: #fff; min-width: 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 0; }
legend { font-size: 13px; color: var(--muted); padding: 0 4px; }
.small { font-size: 13px; }
.login .form-col { text-align: left; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.regions { columns: 2; column-gap: 16px; }
.regions label { break-inside: avoid; }
textarea.mono, .pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.pre { white-space: pre-wrap; background: #f9fafb; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 4px 0 10px; }
@media (max-width: 640px) { .regions { columns: 1; } }
.lot-list { display: flex; flex-direction: column; gap: 10px; }
.lot-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 16px; align-items: center; color: inherit; padding: 12px; }
.lot-row:hover { text-decoration: none; border-color: #b2c4f5; }
.lot-thumb img { width: 120px; height: 84px; object-fit: cover; border-radius: 8px; background: #e4e7ec; display: block; }
.lot-title { font-weight: 600; }
.lot-main > * + * { margin-top: 3px; }
.lot-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; }
.score { font-size: 26px; font-weight: 700; line-height: 1; }
.score small { font-size: 11px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.score.inline { font-size: 22px; }
.lot-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.photo { position: relative; display: block; }
.photo img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; display: block; background: #e4e7ec; }
.photo input { position: absolute; top: 6px; left: 6px; width: 18px; height: 18px; }
.pre-line { white-space: pre-line; }
.warn-text { color: var(--warn); }
.post-text { width: 100%; }
@media (max-width: 900px) { .lot-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .lot-row { grid-template-columns: 84px 1fr; } .lot-thumb img { width: 84px; height: 64px; } .lot-side { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; } }
@media (max-width: 1360px) { .topbar .brand small { display: none; } nav.main a { padding: 8px 6px; font-size: 14px; } }
