:root {
  --u-blue: #2e3092; --u-navy: #23255f; --u-yellow: #fdb913;
  --text: #242730; --muted: #7a7f8c; --line: #e3e5ec; --bg: #f5f6fa; --card: #fff;
  --bad: #c62828; --bad-bg: #fdecea; --ok: #2e7d32; --go: #1565c0;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--u-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 10px; color: var(--u-navy); }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.top { display: flex; align-items: center; gap: 20px; padding: 0 16px; height: 52px; background: var(--u-navy); color: #fff; }
.top a { color: #fff; }
.brand { font-weight: 600; white-space: nowrap; }
.logo { background: var(--u-yellow); color: var(--u-navy); padding: 2px 6px; border-radius: 3px; margin-right: 6px; font-weight: 800; }
.top nav { display: flex; gap: 4px; flex: 1; }
.top nav a { padding: 6px 10px; border-radius: 4px; opacity: .85; }
.top nav a.on, .top nav a:hover { background: rgba(255,255,255,.12); opacity: 1; text-decoration: none; }
.who { display: flex; gap: 8px; align-items: center; font-size: 13px; }
button.link { background: none; border: 0; color: var(--u-yellow); cursor: pointer; padding: 0; font: inherit; }

main { padding: 16px; max-width: 1400px; margin: 0 auto; }
.head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 16px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cols > .card { margin-bottom: 0; }
.cols + * { margin-top: 16px; }

.kpis { display: grid; grid-template-columns: repeat(9, 1fr); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--u-blue); border-radius: 8px; padding: 10px 12px; }
.kpi .v { font-size: 24px; font-weight: 700; }
.kpi .l { font-size: 12px; color: var(--muted); }
.kpi.bad { border-top-color: var(--bad); } .kpi.bad .v { color: var(--bad); }
.kpi.ok { border-top-color: var(--ok); }
.kpi.go { border-top-color: var(--u-yellow); }

.scroll { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; border-bottom: 2px solid var(--line); padding: 6px 8px; white-space: nowrap; }
.grid td { border-bottom: 1px solid var(--line); padding: 6px 8px; vertical-align: middle; }
.grid td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.grid tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
.grid tr.row-bad td:first-child { box-shadow: inset 3px 0 var(--bad); }
td.hot, b.hot, .hot { color: var(--bad); font-weight: 600; }
td.zero { color: #b8bcc8; }
.matrix td.hot { background: var(--bad-bg); }
.bar { display: inline-block; width: 60px; height: 6px; background: var(--line); border-radius: 3px; margin-right: 6px; vertical-align: middle; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--u-blue); }
.chart { height: 280px; margin-top: 12px; }

.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 10px; background: #fff4d6; color: #8a5a00; border: 1px solid #f5d98a; }
.tag-ceo { background: #ede7f6; color: #4527a0; border-color: #d1c4e9; }
.stage, .st { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: #eceef4; white-space: nowrap; }
.stage-opened, .st-done { background: #e8f5e9; color: var(--ok); }
.stage-paused, .st-blocked { background: var(--bad-bg); color: var(--bad); }
.st-in_progress { background: #e8eaf6; color: var(--u-blue); }
.st-not_needed { color: var(--muted); }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-bottom: 16px; }
.facts > div { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.facts span { display: block; font-size: 11px; color: var(--muted); }

.task { display: flex; gap: 12px; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.task.is-overdue { box-shadow: inset 3px 0 var(--bad); padding-left: 8px; }
.task.is-go { box-shadow: inset 3px 0 var(--u-yellow); padding-left: 8px; }
.no { display: inline-block; min-width: 22px; color: var(--muted); font-variant-numeric: tabular-nums; }
.go { color: var(--go); }
.t-form, form.inline { display: flex; gap: 6px; flex-wrap: wrap; }
.t-form { flex: 0 0 auto; flex-wrap: nowrap; }
input, select, button { font: inherit; padding: 5px 8px; border: 1px solid #c9ccd6; border-radius: 4px; background: #fff; }
button, .button { background: var(--u-blue); color: #fff; border-color: var(--u-blue); cursor: pointer; display: inline-block; padding: 6px 12px; border-radius: 4px; }
.alert { background: var(--bad-bg); color: var(--bad); padding: 8px 12px; border-radius: 6px; }

.login { max-width: 360px; margin: 10vh auto; background: var(--card); padding: 24px; border-radius: 8px; border: 1px solid var(--line); }
.stack { display: grid; gap: 12px; }
.stack label { display: grid; gap: 4px; }

@media (max-width: 1300px) { .kpis { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(3, 1fr); } .cols { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  main { padding: 12px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .top { height: auto; flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .top nav { order: 3; width: 100%; }
  .task { flex-direction: column; align-items: stretch; }
  .t-form { flex-wrap: wrap; }
  .t-form input { flex: 1; }
}
.note { background: #e8f5e9; color: var(--ok); padding: 8px 12px; border-radius: 6px; }
.filters { margin-bottom: 10px; }
s { color: var(--muted); }
.teams { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 12px; background: #5b5fc7; color: #fff !important; vertical-align: middle; white-space: nowrap; }
.head .teams { font-size: 14px; padding: 5px 12px; }
.teams.teams-none { background: transparent; color: #5b5fc7 !important; border: 1px solid #5b5fc7; padding: 1px 8px; cursor: help; }
.head .teams.teams-none { padding: 4px 11px; }
.teams:hover { background: #4f52b2; text-decoration: none; }

/* Новини та повідомлення */
.bell { position: relative; display: inline-flex; align-items: center; padding: 6px; border-radius: 4px; opacity: .9; }
.bell:hover, .bell.on { background: rgba(255,255,255,.12); opacity: 1; text-decoration: none; }
.bell .badge { position: absolute; top: 0; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--u-yellow); color: var(--u-navy); font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; }
.bell .badge[hidden] { display: none; }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 12px; }
.tabs a { padding: 8px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tabs a.on { color: var(--u-navy); border-bottom-color: var(--u-blue); text-decoration: none; }
.pill { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--u-blue); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 14px; border: 1px solid var(--line); color: var(--text); font-size: 13px; }
.chip.on { background: var(--u-blue); border-color: var(--u-blue); color: #fff; text-decoration: none; }
.inbox-filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.inbox-filters .right { margin-left: auto; }
button.ghost, .button.ghost { background: #fff; color: var(--u-blue); border: 1px solid #c9ccd6; padding: 4px 10px; }
button.ghost:hover, .button.ghost:hover { border-color: var(--u-blue); text-decoration: none; }
button.danger { color: var(--bad); }
.bulk { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--line); }
.day { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin: 14px 0 4px; }
.msgs, .news { list-style: none; margin: 0; padding: 0; }
.msg { display: flex; gap: 10px; align-items: flex-start; padding: 8px 8px; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; }
.msg input { margin-top: 4px; }
.msg-main, .news-item > a { display: grid; gap: 2px; flex: 1; color: var(--text); min-width: 0; }
.msg-main:hover, .news-item > a:hover { text-decoration: none; }
.msg:hover, .news-item:hover { background: #fafbfe; }
.msg-top { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.kind { font-size: 11px; font-weight: 600; color: var(--u-blue); text-transform: uppercase; letter-spacing: .03em; }
.msg-title { font-weight: 500; }
.unread .msg-title { font-weight: 700; }
.unread { background: #f5f7ff; }
.msg-body { color: var(--muted); font-size: 13px; white-space: pre-line; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.msg.sev-warn { border-left-color: var(--u-yellow); }
.msg.sev-critical { border-left-color: var(--bad); }
.msg.sev-critical .kind { color: var(--bad); }
.news-item { padding: 10px 8px; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; }
.news-item.important, .article.important { border-left: 3px solid var(--bad); }
.unread .msg-title::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--u-blue); margin-right: 6px; vertical-align: middle; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.compose summary { cursor: pointer; font-weight: 600; color: var(--u-blue); }
.compose form { margin-top: 12px; }
textarea { font: inherit; padding: 6px 8px; border: 1px solid #c9ccd6; border-radius: 4px; width: 100%; }
.stack input[name="title"] { width: 100%; }
.article { max-width: 760px; }
.article h1 { margin: 6px 0 12px; }
.article-body { white-space: pre-line; font-size: 15px; line-height: 1.6; }
.actions { margin-top: 16px; gap: 6px; }
.opts { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.stack .opts label { display: inline-flex; gap: 6px; align-items: center; }

/* Мої сповіщення */
.who a { color: #fff; opacity: .9; }
.who a.on, .who a:hover { opacity: 1; }
.settings .card h3 { font-size: 14px; margin: 16px 0 6px; color: var(--u-navy); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.checks label, .settings label { display: inline-flex; gap: 6px; align-items: center; }
.settings label.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.settings label.wide input { flex: 1; min-width: 260px; }
.settings ol { margin: 6px 0; padding-left: 20px; }

/* Digest Development */
.digest-kpis { grid-template-columns: repeat(8, 1fr); }
.good { color: var(--ok); font-weight: 600; }
ul.plain { margin: 0; padding-left: 18px; }
ul.plain li { margin: 3px 0; }
.printonly { display: none; }
@media (max-width: 1300px) { .digest-kpis { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 640px) { .digest-kpis { grid-template-columns: repeat(2, 1fr); } }
@media print {
  .top, .noprint, .teams { display: none !important; }
  .printonly { display: block; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  .card, .kpi { break-inside: avoid; border-color: #ccc; }
  a { color: inherit; }
}
ol.steps { margin: 4px 0 12px; padding-left: 22px; display: grid; gap: 8px; }
ol.steps .button { color: #fff; }

/* ===== Нова структура: меню з 12 розділів, світлофор, потік, картка АЗС ===== */
:root { --red: #c8323b; --red-bg: #fbe4e5; --amber: #a86a00; --amber-bg: #fff1cc; --green: #1f7a4d; --green-bg: #ddf3e7; --grey-bg: #eceef3; }
.top { justify-content: space-between; }
.menu { display: flex; gap: 2px; overflow-x: auto; background: #fff; border-bottom: 1px solid var(--line); padding: 0 12px; position: sticky; top: 0; z-index: 5; scrollbar-width: thin; }
.menu a { padding: 11px 11px 9px; color: var(--muted); white-space: nowrap; border-bottom: 3px solid transparent; font-weight: 500; }
.menu a.on { color: var(--u-navy); border-bottom-color: var(--u-yellow); font-weight: 700; }
.menu a:hover { color: var(--u-navy); text-decoration: none; }
.cnt { display: inline-block; font-size: 11px; background: var(--red); color: #fff; border-radius: 999px; padding: 0 6px; margin-left: 5px; line-height: 17px; font-weight: 700; }
.card > header.ph { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.card > header.ph h2 { margin: 0; }
h3.sub { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 12px 0 6px; }

.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; border: 2px solid transparent; background: var(--grey-bg); color: var(--text) !important; }
.tile:hover { text-decoration: none; border-color: #c9ccd6; }
.tile b { font-size: 28px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile small { color: var(--muted); font-size: 12px; }
.tile.r { background: var(--red-bg); } .tile.r b { color: var(--red); }
.tile.a { background: var(--amber-bg); } .tile.a b { color: var(--amber); }
.tile.g { background: var(--green-bg); } .tile.g b { color: var(--green); }
.tile.on { border-color: var(--u-blue); }

.light { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: #d3d6df; vertical-align: -1px; flex: none; }
.light.r { background: var(--red); } .light.a { background: var(--u-yellow); } .light.g { background: var(--green); }
.tag.r { background: var(--red-bg); color: var(--red); border-color: transparent; }
.tag.a { background: var(--amber-bg); color: var(--amber); border-color: transparent; }
.tag.g { background: var(--green-bg); color: var(--green); border-color: transparent; }
.tag:not(.r):not(.a):not(.g):not(.tag-ceo) { background: var(--grey-bg); color: var(--muted); border-color: transparent; }
.shift { color: var(--red); font-size: 12px; font-weight: 600; }

.list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.item { display: grid; grid-template-columns: 6px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item .t { font-weight: 600; } .item .s { font-size: 13px; color: var(--muted); }
.sev { width: 6px; align-self: stretch; border-radius: 3px; background: var(--line); }
.sev.r { background: var(--red); } .sev.a { background: var(--u-yellow); } .sev.g { background: var(--green); }
.btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: flex-start; }
.btns.left { justify-content: flex-start; margin-bottom: 14px; }
button.ok, .button.ok { background: #fff; color: var(--green); border: 1px solid var(--green); }
button.no, .button.no { background: #fff; color: var(--red); border: 1px solid var(--red); }
button, .button, button.ghost, .button.ghost { padding: 5px 11px; font-size: 13px; font-weight: 600; border-radius: 7px; }
.steps:not(ol) { display: flex; gap: 4px; align-items: center; font-size: 12px; flex-wrap: wrap; margin-top: 5px; color: var(--muted); }
.steps:not(ol) span { padding: 2px 8px; border-radius: 999px; background: var(--grey-bg); }
.steps span.done { background: var(--green-bg); color: var(--green); }
.steps span.now { background: var(--amber-bg); color: var(--amber); font-weight: 700; }
.steps span.rej { background: var(--red-bg); color: var(--red); }

details.pop { position: relative; display: inline-block; }
details.pop > summary { list-style: none; cursor: pointer; }
details.pop > summary::-webkit-details-marker { display: none; }
details.pop[open] > form { position: absolute; z-index: 20; right: 0; top: calc(100% + 6px); width: min(340px, 86vw); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(20,22,40,.18); padding: 12px; }
.btns.left details.pop[open] > form { left: 0; right: auto; }
.stack input, .stack select, .stack textarea { width: 100%; }

.kan { display: grid; grid-template-columns: repeat(8, minmax(150px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 6px; margin-top: 10px; }
.kan.kan7 { grid-template-columns: repeat(7, minmax(150px, 1fr)); }
.kcol { background: var(--bg); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 6px; min-height: 120px; }
.kcol h3 { font-size: 12.5px; display: flex; justify-content: space-between; gap: 6px; margin: 0 0 2px; color: var(--u-navy); }
.kcard { background: #fff; border: 1px solid var(--line); border-left: 4px solid #d3d6df; border-radius: 8px; padding: 7px 9px; font-size: 13px; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.kcard.r { border-left-color: var(--red); } .kcard.a { border-left-color: var(--u-yellow); } .kcard.g { border-left-color: var(--green); }
.kcard.proj { border-style: dashed; border-left-style: solid; border-left-color: var(--muted); }
.kcard small { font-size: 12px; }
.seg { display: inline-flex; gap: 4px; }
.seg a { border: 1px solid var(--line); padding: 5px 12px; border-radius: 999px; font-weight: 600; font-size: 13px; color: var(--text); }
.seg a.on { background: var(--u-blue); color: #fff; border-color: var(--u-blue); text-decoration: none; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

details.stg { border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-bottom: 8px; }
details.stg > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; font-weight: 600; }
details.stg > summary::-webkit-details-marker { display: none; }
details.stg[open] > summary { border-bottom: 1px solid var(--line); background: var(--bg); border-radius: 10px 10px 0 0; }
.trow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 9px 12px; border-top: 1px solid var(--line); align-items: center; border-left: 3px solid transparent; }
.list .trow:first-child, details.stg .trow:first-of-type { border-top: 0; }
.trow.r { border-left-color: var(--red); } .trow.a { border-left-color: var(--u-yellow); } .trow.g { border-left-color: var(--green); }
.trow .t { font-weight: 600; } .trow .s { font-size: 12.5px; color: var(--muted); }
.trow > .btns, .trow > details { grid-column: 1 / -1; justify-content: flex-start; }
.trow > .btns + details.pop { grid-column: auto; }
.sel { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: start; border-top: 1px solid var(--line); }
.sel:first-child { border-top: 0; } .sel > input { margin: 13px 0 0 8px; } .sel .trow { border-top: 0; }

.regs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.reg { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.reg h2 { margin: 0; } .kp { display: flex; gap: 6px; flex-wrap: wrap; }
ul.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; } ul.checklist li.ok { color: var(--green); }

.gantt { overflow-x: auto; }
.g-row { display: grid; grid-template-columns: 170px minmax(480px, 1fr) 70px; gap: 10px; align-items: center; font-size: 13px; padding: 3px 0; }
.g-row > a { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track { position: relative; height: 20px; background: var(--grey-bg); border-radius: 5px; }
.track.bare { background: none; height: 16px; }
.track .mon { position: absolute; font-size: 11px; color: var(--muted); }
.track i { position: absolute; top: 0; bottom: 0; border-radius: 5px; background: #b9bdc9; }
.track i.r { background: var(--red); } .track i.a { background: var(--u-yellow); } .track i.g { background: var(--green); }
.track .base { position: absolute; top: -3px; width: 3px; height: 26px; background: var(--u-blue); }
.track .today { position: absolute; top: -4px; width: 2px; height: 28px; background: var(--text); opacity: .6; }

.fmap { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; }
.fm { flex: 1 1 180px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--bg); display: flex; flex-direction: column; gap: 4px; }
.fm span { font-size: 12.5px; color: var(--muted); } .fm.work { border: 2px solid var(--u-blue); } .fm.dash { border: 2px solid var(--u-yellow); }
.fa { align-self: center; color: var(--muted); font-size: 18px; }
.phases { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.phase { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--bg); } .phase.now { border: 2px solid var(--u-blue); } .phase h3 { margin: 4px 0 6px; }
table.wrap td { white-space: normal; vertical-align: top; }
.cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .cols { grid-template-columns: minmax(0, 1fr); } }
.empty { padding: 16px; }

@media (max-width: 1100px) { .regs, .phases { grid-template-columns: 1fr; } .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .item { grid-template-columns: 6px minmax(0, 1fr); } .item > .btns, .item > :last-child:not(div) { grid-column: 2; justify-content: flex-start; }
  .g-row { grid-template-columns: 110px minmax(420px, 1fr) 60px; }
  .top nav { display: none; }
}
@media print { .menu, .bell, details.pop { display: none !important; } }
.tabs { overflow-x: auto; } .tabs a { white-space: nowrap; }
@media (max-width: 640px) { .settings label.wide input { min-width: 0; width: 100%; } }

/* Плитка → список саме цих АЗС під плитками */
.card.focus { border: 2px solid var(--u-blue); scroll-margin-top: 56px; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 10px; }
.fcard { border: 1px solid var(--line); border-left: 4px solid #d3d6df; border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.fcard.r { border-left-color: var(--red); } .fcard.a { border-left-color: var(--u-yellow); } .fcard.g { border-left-color: var(--green); }
.fhead { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; } .fhead b { font-size: 15px; }
.fcard .facts { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; color: var(--muted); } .fcard .facts b { color: var(--text); }
ul.why { margin: 0; padding-left: 18px; font-size: 13px; display: grid; gap: 3px; }
ul.why li.r::marker { color: var(--red); } ul.why li.a::marker { color: var(--amber); } ul.why li.g::marker { color: var(--green); }
@media (max-width: 640px) { .fgrid { grid-template-columns: minmax(0, 1fr); } }

/* ШІ-помічник */
.ai-cols { grid-template-columns: 3fr 2fr; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ai-chips button { font: inherit; font-size: 12px; cursor: pointer; border: 1px solid var(--line); background: var(--bg); border-radius: 14px; padding: 4px 10px; color: var(--u-navy); }
.ai-chips button.ai-overview { background: var(--u-yellow); border-color: var(--u-yellow); font-weight: 600; }
.ai-chips button:disabled { opacity: .5; cursor: default; }
.ai-log { max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.ai-msg { padding: 8px 12px; border-radius: 8px; max-width: 95%; }
.ai-msg p { margin: 0 0 6px; } .ai-msg p:last-child { margin: 0; }
.ai-msg h4 { margin: 8px 0 4px; color: var(--u-navy); }
.ai-msg ul, .ai-msg ol { margin: 4px 0 6px; padding-left: 20px; }
.ai-msg.user { align-self: flex-end; background: #e8eaf6; }
.ai-msg.assistant { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); }
.ai-msg.wait { color: var(--muted); font-style: italic; }
.ai-msg.err { background: var(--bad-bg); color: var(--bad); }
.ai-form textarea { width: 100%; font: inherit; padding: 8px; border: 1px solid var(--line); border-radius: 6px; resize: vertical; }
.ai-form div { display: flex; gap: 12px; align-items: center; margin-top: 6px; }
.ai-form button.link { color: var(--u-blue); }
.ai-advice { margin: 0; padding-left: 20px; } .ai-advice li { margin-bottom: 6px; }
.ai-advice li.p1 a { color: var(--bad); font-weight: 600; }
.ai-advice li.p2 a { color: var(--text); }
.warn { background: #fff8e1; color: #7a5b00; padding: 8px 12px; border-radius: 6px; }
@media (max-width: 1100px) { .ai-cols { grid-template-columns: 1fr; } }
.ai-banner { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; background: var(--u-navy); color: #fff; border-left: 4px solid var(--u-yellow); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }
.ai-banner b { color: var(--u-yellow); } .ai-banner span { opacity: .85; font-size: 13px; }
.ai-banner:hover { text-decoration: none; filter: brightness(1.15); }
.ai-fab { position: fixed; right: 18px; bottom: 18px; z-index: 50; width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer; background: var(--u-navy); color: var(--u-yellow); font-weight: 800; font-size: 16px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.ai-fab[aria-expanded="true"] { background: var(--u-yellow); color: var(--u-navy); }
.ai-pop { position: fixed; right: 18px; bottom: 80px; z-index: 50; width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 120px); display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.2); padding: 10px 12px; }
.ai-pop[hidden] { display: none; }
.ai-pop header { display: flex; gap: 10px; align-items: baseline; margin-bottom: 8px; }
.ai-pop header b { color: var(--u-navy); flex: 1; }
.ai-x { border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted); }
.ai-pop .ai-log { flex: 1; min-height: 80px; max-height: none; }
@media (max-width: 600px) { .ai-pop { right: 8px; left: 8px; width: auto; bottom: 76px; } .ai-fab { right: 12px; bottom: 12px; } }
@media print { .ai-fab, .ai-pop { display: none !important; } }
.ai-msg hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
.ai-msg table { margin: 6px 0; }
.kan.kan9 { grid-template-columns: repeat(9, minmax(150px, 1fr)); }
.kcard small.hot { color: var(--bad); }
.omx th { font-size: 11.5px; font-weight: 600; vertical-align: bottom; min-width: 78px; }
.omx td.om { text-align: center; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.omx td.om.g { background: #e8f5e9; color: var(--ok); font-weight: 700; }
.omx td.om.a { background: #fff8e1; color: #7a5b00; }
.omx td.om.r { background: var(--bad-bg); color: var(--bad); font-weight: 600; }
.omx td.om.n { color: var(--muted); }
/* Картка АЗС на дошці: наведення (або дотик) показує проблеми і дії поруч */
.kcard { position: relative; }
.khead { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.kmore { display: none; position: absolute; left: -4px; top: 100%; z-index: 20; width: min(380px, 80vw); background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 10px 12px; margin-top: 2px; cursor: default; }
.kmore::before { content: ''; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
.kcard:hover, .kcard:focus-within, .kcard.open { z-index: 20; }
.kcard:hover > .kmore, .kcard:focus-within > .kmore, .kcard.open > .kmore { display: block; }
.kcol:last-child .kmore, .kcol:nth-last-child(2) .kmore { left: auto; right: -4px; }
.kmore ul.why { margin: 0 0 8px; padding-left: 16px; font-size: 12px; }
.kbtns { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.kbtns .button, .kbtns button { font-size: 12px; padding: 3px 8px; }
@media (hover: none) { .kcard:hover > .kmore { display: none; } .kcard.open > .kmore { display: block; } }
@media (max-width: 600px) { .kmore { position: static; width: auto; box-shadow: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 6px 0 0; margin-top: 6px; } }
/* АЗС на паузі: стара дата минула, нової немає — проблема, рахуємо від Дня 0 */
:root { --pause: #7b1e4b; --pause-bg: #f4e1ea; }
.light.p, .sev.p, .track i.p { background: var(--pause); }
.tile.p { background: var(--pause-bg); } .tile.p b { color: var(--pause); }
.kcard.p, .trow.p, .fcard.p { border-left-color: var(--pause); }
ul.why li.p::marker { color: var(--pause); } ul.why li.p { color: var(--pause); }
.asks { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.ask { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.ask h3 { font-size: 13.5px; margin: 0 0 4px; color: var(--u-navy); }
.ask ul.plain li { margin-bottom: 3px; }
.ai-fab { width: 60px; height: 60px; font-size: 14px; }
