:root {
  --bg: #f6f7f9; --card: #fff; --txt: #1d232b; --dim: #6b7480; --border: #dde1e6;
  --accent: #2563eb; --red: #c62828;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111418; --card: #1a1f25; --txt: #e8ebef; --dim: #98a1ab; --border: #2b323a; --accent: #6b9bff; --red: #ff7b7b; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--txt); font: 15px/1.5 -apple-system, system-ui, sans-serif; }
main { max-width: 960px; margin: 0 auto; padding: 24px 16px; }
h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 0 0 8px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 14px; }
.narrow { max-width: 360px; margin: 10vh auto 0; display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--dim); }
input { font: inherit; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--txt); }
button { font: inherit; font-weight: 600; padding: 9px 14px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; }
button.link { background: none; color: var(--accent); padding: 0; }
.error { color: var(--red); margin: 0; }
.hint { color: var(--dim); font-size: 12px; margin: 0; }
.bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.bar h1 { margin: 0; }
.sources { margin: 0; padding-left: 18px; }
.actions { display: flex; gap: 12px; align-items: center; }
a.button { display: inline-block; font-weight: 600; padding: 9px 14px; border-radius: 8px; background: var(--accent); color: #fff; text-decoration: none; }
button:disabled { opacity: .6; cursor: default; }
.note { background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 12px; }
.scroll { overflow-x: auto; margin-top: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-size: 12px; color: var(--dim); font-weight: 600; padding: 6px 10px 6px 0; white-space: nowrap; }
td { padding: 7px 10px 7px 0; border-top: 1px solid var(--border); white-space: nowrap; }
td.num { font-variant-numeric: tabular-nums; }
.good { color: #16a34a; } .mid { color: #d97706; } .low { color: var(--red); }
a.plain { color: inherit; text-decoration: none; }
a { color: var(--accent); }
.upload { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.high { color: var(--red); } 
tr.doubt td { background: rgba(217, 119, 6, .08); }
tr.dim td { opacity: .5; }
.review input:not([type=checkbox]) { padding: 4px 6px; font-size: 13px; }
input.flagged { border-color: var(--red); }
.check { flex-direction: row; align-items: center; gap: 8px; color: var(--txt); margin: 6px 0 10px; }
table.dyn td:first-child { white-space: normal; min-width: 180px; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart .grid { stroke: var(--border); stroke-width: 1; }
svg.chart .ax { fill: var(--dim); font-size: 11px; }
svg.chart .band { fill: rgba(22, 163, 74, .10); }
svg.chart .mark { stroke: var(--dim); stroke-dasharray: 4 4; }
svg.chart .mark-t { fill: var(--dim); font-size: 11px; }
svg.chart .line { fill: none; stroke-width: 2; }
svg.chart .s0 { stroke: #2563eb; fill: #2563eb; } svg.chart .line.s0 { fill: none; }
svg.chart .s1 { stroke: #ea580c; fill: #ea580c; } svg.chart .line.s1 { fill: none; }
svg.chart .s2 { stroke: #16a34a; fill: #16a34a; } svg.chart .line.s2 { fill: none; }
svg.chart .s3 { stroke: #9333ea; fill: #9333ea; } svg.chart .line.s3 { fill: none; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--dim); margin-top: 4px; }
.lg::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.lg.s0::before { background: #2563eb; } .lg.s1::before { background: #ea580c; } .lg.s2::before { background: #16a34a; } .lg.s3::before { background: #9333ea; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.grid2 .card { margin-bottom: 0; }
h2.sect { font-size: 15px; margin: 22px 0 10px; color: var(--dim); }
.report h2 { font-size: 17px; margin: 22px 0 8px; }
.report h3 { font-size: 15px; margin: 16px 0 6px; }
.report p, .report li { line-height: 1.55; }
.report ul { padding-left: 20px; }
code { font-size: 13px; background: var(--bg); padding: 1px 4px; border-radius: 4px; }
.gap-top { margin-top: 10px; }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.files img { height: 110px; border-radius: 8px; border: 1px solid var(--border); display: block; }

/* «План» (27.10.2026) */
textarea.brief, textarea.result { width: 100%; box-sizing: border-box; font: inherit; font-size: 14px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: inherit; }
textarea.brief { resize: none; color: var(--muted, #888); }
.ok { color: #1a7f37; font-weight: 600; }
.err { color: #c62828; font-weight: 600; }

/* Меню как в кабинете (28.10.2026): разделы сверху, вкладки раздела ниже */
.topnav { position: sticky; top: 0; z-index: 10; background: var(--card); border-bottom: 1px solid var(--border); }
.topnav .groups, .topnav .tabs { max-width: 960px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 4px;
  overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.topnav .groups::-webkit-scrollbar, .topnav .tabs::-webkit-scrollbar { display: none; }
.topnav .groups { padding-top: 8px; padding-bottom: 6px; }
.topnav .brand { font-weight: 800; font-size: 14px; margin-right: 10px; color: #16a34a; text-decoration: none; }
.topnav .grp { padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--dim); text-decoration: none; }
.topnav .grp.on { background: var(--accent); color: #fff; }
.topnav .out { margin-left: auto; padding-left: 12px; }
.topnav .out button { font-size: 13px; }
.topnav .tabs { border-top: 1px solid var(--border); }
.topnav .tab { padding: 9px 11px; font-size: 12.5px; color: var(--dim); text-decoration: none; border-bottom: 2px solid transparent; }
.topnav .tab.on { color: var(--accent); font-weight: 700; border-bottom-color: var(--accent); }
.days-ok { color: #16a34a; } .days-soon { color: #d97706; font-weight: 600; } .days-late { color: var(--red); font-weight: 700; }
.pill { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--dim); margin: 1px 2px 1px 0; }

/* Кнопки разделов «Задачи → Список» (29.10.2026) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--border); color: var(--txt); text-decoration: none;
  font-size: 14px; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.05); transition: border-color .15s, transform .15s; }
.chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.chip.on { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.chip .ic { font-size: 16px; }
.chip .cnt { min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--bg); color: var(--dim); font-size: 12px; text-align: center; }
.chip .urg { padding: 1px 6px; border-radius: 999px; background: rgba(217,119,6,.15); color: #d97706; font-size: 12px; }
h2.sect .up { font-weight: 400; margin-left: 8px; text-decoration: none; }
section.task { scroll-margin-top: 110px; } h2.sect { scroll-margin-top: 110px; }

/* Группировка задач: Разделы · Где · Срочность · Кто (29.10.2026) */
.seg { display: inline-flex; margin: 10px 0 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--card); }
.seg a { padding: 7px 14px; text-decoration: none; color: var(--txt); font-size: 14px; font-weight: 600; border-right: 1px solid var(--border); }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--accent); color: #fff; }
.tags { margin: 4px 0 6px; }
.pill.hot { border-color: #d97706; color: #d97706; }

/* «Дом → План» (31.10.2026) */
.house-lead { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.house-lead .card { margin-bottom: 0; }
.house-status { border-left: 4px solid #d97706; }
.house-status strong { color: #d97706; }
.house-list { margin: 8px 0 0; padding-left: 20px; }
.house-list li + li { margin-top: 5px; }
.house-plan { width: 100%; height: auto; display: block; margin-top: 12px; }
.house-plan text { fill: var(--txt); font-family: inherit; text-anchor: middle; }
.house-plan .room { stroke: var(--txt); stroke-width: 1.5; }
.house-plan .main { fill: rgba(37, 99, 235, .13); }
.house-plan .annex { fill: rgba(22, 163, 74, .13); }
.house-plan .cold { fill: rgba(217, 119, 6, .13); }
.house-plan .outline { fill: none; stroke: var(--txt); stroke-width: 4; }
.house-plan .label { font-size: 19px; font-weight: 700; }
.house-plan .area, .house-plan .dim { font-size: 15px; fill: var(--dim); }
.house-plan .room-no { font-size: 20px; font-weight: 700; }
.house-plan .street { stroke: var(--dim); stroke-width: 1.5; }
.house-legend { display: flex; flex-wrap: wrap; gap: 12px 20px; color: var(--dim); font-size: 12px; margin-top: 10px; }
.house-legend i { display: inline-block; width: 11px; height: 11px; margin-right: 6px; vertical-align: -1px; border: 1px solid var(--border); }
.house-legend .main { background: rgba(37, 99, 235, .25); }
.house-legend .annex { background: rgba(22, 163, 74, .25); }
.house-legend .cold { background: rgba(217, 119, 6, .25); }
.house-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.house-options .card { margin-bottom: 0; min-width: 0; }
.house-option { width: 100%; height: auto; display: block; margin: 12px 0; }
.house-option text { fill: var(--txt); font-family: inherit; text-anchor: middle; }
.house-option .new { fill: rgba(37, 99, 235, .16); stroke: var(--txt); stroke-width: 2; }
.house-option .service { fill: rgba(22, 163, 74, .16); stroke: var(--txt); stroke-width: 2; }
.house-option .existing { fill: rgba(107, 116, 128, .16); stroke: var(--txt); stroke-width: 2; }
.house-option .unknown { fill: transparent; stroke: var(--dim); stroke-width: 1.5; stroke-dasharray: 7 5; }
.house-option .big { font-size: 18px; font-weight: 700; }
.house-option .small { font-size: 14px; fill: var(--dim); }
@media (max-width: 700px) {
  .house-lead, .house-options { grid-template-columns: 1fr; }
  .house-plan .label { font-size: 15px; }
  .house-plan .area, .house-plan .dim { font-size: 12px; }
}

/* Задачи: краткое описание и раскрывающиеся подробности. */
.task-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.task-filters select { width: 100%; min-width: 0; font: inherit; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--txt); }
.task-filter-actions { display: flex; align-items: center; gap: 16px; grid-column: 1 / -1; }
.task-filter-count { grid-column: 1 / -1; }
.task-snapshot { margin-top: 5px; }
.task-heading { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 5px; }
.task-title { margin: 0 0 5px; font-size: 17px; line-height: 1.35; }
.task-summary { margin: 0 0 10px; color: var(--dim); line-height: 1.5; }
.task .tags { margin: 7px 0 10px; }
.task-details, .task-update { border-top: 1px solid var(--border); }
.task-details > summary, .task-update > summary { padding: 9px 0; cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 600; list-style: none; }
.task-details > summary::-webkit-details-marker, .task-update > summary::-webkit-details-marker { display: none; }
.task-details > summary::before { content: "+"; display: inline-block; width: 20px; font-size: 17px; }
.task-details[open] > summary::before { content: "−"; }
.task-update > summary::before { content: "✎"; display: inline-block; width: 20px; }
.task-details .report { overflow-wrap: anywhere; }
.task-details .report p { margin: 8px 0; }
.task-update .gap-top { margin-top: 2px; }
.task-update form > p { margin: 8px 0 0; }
.task-summary, .task-title { overflow-wrap: anywhere; }

/* Главная: быстрые входящие с телефона (31.10.2026) */
.inbox-compose { border-top: 4px solid #16a34a; scroll-margin-top: 110px; }
.inbox-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.inbox-heading h1 { margin-bottom: 2px; }
.inbox-count { flex: none; padding: 4px 9px; border-radius: 999px; background: rgba(217,119,6,.13); color: #d97706; font-size: 12px; font-weight: 700; }
.inbox-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.inbox-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.inbox-file-button, .inbox-record { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 9px 13px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); color: var(--txt); font-size: 14px; font-weight: 700; cursor: pointer; }
.inbox-record.recording { border-color: var(--red); color: var(--red); animation: record-pulse 1.2s ease-in-out infinite; }
.inbox-save { margin-left: auto; min-height: 40px; background: #16a34a; }
.inbox-status { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-preview { display: block; width: min(100%, 420px); margin-top: 10px; }
.inbox-preview[hidden] { display: none; }
.inbox-list > h2 { margin-bottom: 2px; }
.inbox-item { padding: 13px 0; border-top: 1px solid var(--border); }
.inbox-item:first-of-type { border-top: 0; }
.inbox-item.done { opacity: .65; }
.inbox-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--dim); font-size: 12px; }
.inbox-text { margin: 7px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.inbox-audio { display: block; width: min(100%, 420px); margin-top: 8px; }
.inbox-image { display: block; max-width: min(100%, 420px); max-height: 260px; margin-top: 8px; border-radius: 9px; border: 1px solid var(--border); object-fit: contain; }
.inbox-attachment { display: inline-block; margin-top: 8px; font-weight: 600; }
@keyframes record-pulse { 50% { opacity: .55; } }
@media (max-width: 620px) {
  .inbox-heading { display: block; }
  .inbox-count { display: inline-block; margin-top: 8px; }
  .inbox-tools { display: grid; grid-template-columns: 1fr 1fr; }
  .inbox-file-button, .inbox-record { width: 100%; }
  .inbox-status { grid-column: 1 / -1; max-width: none; }
  .inbox-save { grid-column: 1 / -1; width: 100%; margin: 0; }
}
