/* =========================================================
   Prefab ERP — дизайн у стилі TALKO OS
   Світлий, щільний, з зеленим акцентом і кольоровими статусами
   ========================================================= */
:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --line: #e6e8eb;
  --line-strong: #d6d9de;
  --text: #111827;
  --muted: #6b7280;
  --faint: #9ca3af;
  --accent: #16a34a;
  --accent-600: #15803d;
  --accent-50: #ecfdf3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 8px 28px rgba(16, 24, 40, .12);

  --green-bg: #dcfce7;  --green-fg: #15803d;  --green-bd: #bbf7d0;
  --yellow-bg: #fef3c7; --yellow-fg: #a16207; --yellow-bd: #fde68a;
  --orange-bg: #ffedd5; --orange-fg: #c2410c; --orange-bd: #fed7aa;
  --red-bg: #fee2e2;    --red-fg: #b91c1c;    --red-bd: #fecaca;
  --blue-bg: #dbeafe;   --blue-fg: #1d4ed8;   --blue-bd: #bfdbfe;
  --grey-bg: #f3f4f6;   --grey-fg: #6b7280;   --grey-bd: #e5e7eb;
  --violet-bg: #ede9fe; --violet-fg: #6d28d9;
}

html, body { background: var(--bg); }
body { font-family: var(--font); font-size: 13.5px; color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-600); }
h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -.01em; }
.muted { color: var(--muted) !important; }
.faint { color: var(--faint) !important; }
.small-muted { color: var(--muted); font-size: 12px; }
.fw-600 { font-weight: 600; }
.tnum { font-variant-numeric: tabular-nums; }
.cap::first-letter { text-transform: uppercase; }

/* ---------- Кнопки ---------- */
.btn { font-weight: 600; border-radius: 8px; font-size: 13px; }
.btn-sm { padding: .3rem .65rem; font-size: 12.5px; }
.btn-success, .btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-success:hover, .btn-accent:hover { background: var(--accent-600); border-color: var(--accent-600); color: #fff; }
.btn-outline-success { color: var(--accent-600); border-color: var(--green-bd); background: #fff; }
.btn-outline-success:hover { background: var(--accent-50); color: var(--accent-600); border-color: var(--accent); }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: #374151; }
.btn-ghost:hover { background: #f9fafb; border-color: var(--line-strong); color: var(--text); }
.btn-icon { width: 30px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.bg-accent { background: var(--accent) !important; }
.form-control, .form-select { border-color: var(--line-strong); border-radius: 8px; font-size: 13.5px; }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(22,163,74,.15); }
.form-control-sm, .form-select-sm { font-size: 12.5px; }

/* ---------- Шапка ---------- */
.appbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1030; }
.appbar-inner { display: flex; align-items: center; gap: 14px; height: 52px; padding: 0 16px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); flex-shrink: 0; }
.brand .logo { width: 28px; height: 28px; border-radius: 7px; background: var(--text); color: #fff; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; font-size: 15px; position: relative; }
.brand .logo::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px;
  background: var(--accent); border-radius: 3px; border: 2px solid #fff; }
.brand .name { font-weight: 800; letter-spacing: .02em; font-size: 15px; }
.company { font-size: 12px; font-weight: 600; color: #374151; background: var(--grey-bg); border: 1px solid var(--line);
  padding: 3px 9px; border-radius: 6px; white-space: nowrap; }
.mainnav { display: flex; align-items: stretch; gap: 2px; height: 100%; overflow-x: auto; scrollbar-width: none; flex: 1; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a { display: inline-flex; align-items: center; gap: 6px; padding: 0 11px; color: #4b5563; text-decoration: none;
  font-weight: 600; font-size: 13px; white-space: nowrap; border-bottom: 2px solid transparent; }
.mainnav a i { font-size: 15px; opacity: .85; }
.mainnav a:hover { color: var(--text); background: #f9fafb; }
.mainnav a.active { color: var(--accent-600); border-bottom-color: var(--accent); background: var(--accent-50); }
.nbadge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.nbadge.red { background: #ef4444; color: #fff; }
.nbadge.violet { background: #7c3aed; color: #fff; }
.nbadge.orange { background: #f97316; color: #fff; }
.appbar-tools { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.searchbox { position: relative; }
.searchbox input { width: 200px; padding-left: 30px; height: 32px; background: var(--grey-bg); border-color: transparent; }
.searchbox i { position: absolute; left: 10px; top: 8px; color: var(--faint); }
.toolbtn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: #4b5563;
  display: inline-flex; align-items: center; justify-content: center; position: relative; text-decoration: none; }
.toolbtn:hover { background: #f9fafb; color: var(--text); }
.toolbtn .nbadge { position: absolute; top: -6px; right: -6px; }

/* ---------- Аватарки ---------- */
.av { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 700;
  flex-shrink: 0; border: 2px solid #fff; letter-spacing: .02em; }
.av-empty { background: var(--grey-bg); color: var(--faint); border: 1px dashed var(--line-strong); }
.av-stack { display: inline-flex; }
.av-stack .av + .av { margin-left: -7px; }
.av-more { background: var(--grey-bg); color: var(--muted); }

/* ---------- Сторінка ---------- */
.page { padding: 16px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.page-title { font-size: 20px; font-weight: 800; margin: 0; letter-spacing: -.02em; }
.page-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.surface { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card { border-color: var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { background: #fff; border-bottom-color: var(--line); font-weight: 700; font-size: 13px; padding: 10px 14px; }
.section-label { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.section-label.red { color: #dc2626; }

/* Панель інструментів (чіпи-лічильники + перемикачі) */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 7px;
  font-size: 12.5px; font-weight: 600; color: #374151; text-decoration: none; border: 1px solid transparent; background: var(--grey-bg); }
.chip b { font-weight: 800; }
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.active { background: var(--text); color: #fff; }
.chip.c-red { background: var(--red-bg); color: var(--red-fg); }
.chip.c-orange { background: var(--orange-bg); color: var(--orange-fg); }
.chip.c-blue { background: var(--blue-bg); color: var(--blue-fg); }
.chip.c-green { background: var(--green-bg); color: var(--green-fg); }
.chip.c-violet { background: var(--violet-bg); color: var(--violet-fg); }
.chip.c-red.active, .chip.c-orange.active, .chip.c-blue.active, .chip.c-green.active, .chip.c-violet.active { outline: 2px solid currentColor; outline-offset: 1px; }
.seg { display: inline-flex; background: var(--grey-bg); border-radius: 8px; padding: 2px; }
.seg a { padding: 4px 10px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); text-decoration: none; }
.seg a.on { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.tb-sep { width: 1px; height: 20px; background: var(--line); }

/* Пігулки статусів */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px;
  font-weight: 600; white-space: nowrap; background: var(--grey-bg); color: var(--grey-fg); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.nodot::before { display: none; }
.pill.green { background: var(--green-bg); color: var(--green-fg); }
.pill.yellow { background: var(--yellow-bg); color: var(--yellow-fg); }
.pill.orange { background: var(--orange-bg); color: var(--orange-fg); }
.pill.red { background: var(--red-bg); color: var(--red-fg); }
.pill.blue { background: var(--blue-bg); color: var(--blue-fg); }
.pill.violet { background: var(--violet-bg); color: var(--violet-fg); }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11px; font-weight: 700;
  background: var(--grey-bg); color: var(--muted); white-space: nowrap; }
.tag.violet { background: var(--violet-bg); color: var(--violet-fg); }
.tag.red { background: var(--red-bg); color: var(--red-fg); }
.tag.orange { background: var(--orange-bg); color: var(--orange-fg); }
.tag.green { background: var(--green-bg); color: var(--green-fg); }
.tag.blue { background: var(--blue-bg); color: var(--blue-fg); }

/* ---------- Матриця об'єктів × етапів ---------- */
.matrix-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; }
body.panel-open .matrix-wrap { grid-template-columns: minmax(0, 1fr) 380px; }
.matrix-scroll { overflow-x: auto; }
.matrix { width: 100%; border-collapse: separate; border-spacing: 0; }
.matrix thead th { position: sticky; top: 0; background: #fafbfc; font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.matrix thead th.st { text-align: center; }
.matrix td { padding: 5px 6px; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
.matrix tr.prow { cursor: pointer; }
.matrix tr.prow:hover td { background: #fafcfb; }
.matrix tr.prow.selected td { background: var(--accent-50); }
.matrix .pname { font-weight: 700; font-size: 13px; max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.matrix .psub { font-size: 11.5px; color: var(--faint); }
.matrix .pdoc { width: 26px; height: 26px; border-radius: 6px; background: var(--grey-bg); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.matrix tr.grow td { background: #fafbfc; padding: 9px 8px; border-bottom: 1px solid var(--line); }
.grow .gname { font-weight: 800; font-size: 13px; }
.cell { height: 28px; min-width: 92px; border-radius: 6px; font-size: 11.5px; font-weight: 700; display: flex; align-items: center;
  justify-content: center; white-space: nowrap; border: 1px solid transparent; padding: 0 6px; }
.cell.done { background: var(--green-bg); color: var(--green-fg); border-color: var(--green-bd); }
.cell.progress { background: var(--yellow-bg); color: var(--yellow-fg); border-color: var(--yellow-bd); }
.cell.blocker { background: var(--red-bg); color: var(--red-fg); border-color: #f87171; }
.cell.todo { background: #f6f7f9; color: var(--faint); border-color: #eceef1; font-weight: 600; }
.cell.late1 { border: 1.5px dashed #f59e0b; }
.cell.late3 { border: 1.5px dashed #ef4444; }
.cell.empty { background: transparent; border: 1px dashed #eceef1; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend .sw { width: 22px; height: 12px; border-radius: 3px; display: inline-block; vertical-align: -2px; margin-right: 4px; }

/* Бокова панель (праворуч, як у TALKO) */
.sidepanel { position: sticky; top: 64px; max-height: calc(100vh - 76px); overflow-y: auto; display: none; }
body.panel-open .sidepanel { display: block; }
.sp-head { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.sp-body { padding: 12px 14px; }
.sp-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.sp-kv .k { font-size: 11px; color: var(--faint); font-weight: 600; }
.sp-kv .v { font-weight: 700; font-size: 13px; }
.sp-tabs { display: flex; gap: 14px; border-bottom: 1px solid var(--line); margin: 0 -14px 12px; padding: 0 14px; }
.sp-tabs span { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 6px 0; }
.sp-tabs span.on { color: var(--accent-600); border-bottom: 2px solid var(--accent); }
.sp-tabs b { background: var(--grey-bg); border-radius: 8px; padding: 0 5px; font-size: 11px; color: var(--muted); }
.alert-soft { border-radius: 8px; padding: 9px 11px; font-size: 12.5px; }
.alert-soft.red { background: var(--red-bg); color: var(--red-fg); border: 1px solid var(--red-bd); }
.alert-soft.green { background: var(--accent-50); color: var(--green-fg); border: 1px solid var(--green-bd); }
.alert-soft.orange { background: var(--orange-bg); color: var(--orange-fg); border: 1px solid var(--orange-bd); }

/* Етапи кружечками з підписами */
.stepper { display: flex; gap: 2px; overflow-x: auto; padding-bottom: 4px; }
.stepper .s { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 62px; text-align: center; }
.stepper .s span { font-size: 10.5px; color: var(--muted); line-height: 1.15; }
.step { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; border: 2px solid; background: #fff; flex-shrink: 0; }
.step.green { background: var(--accent); border-color: var(--accent); color: #fff; }
.step.blue { border-color: #f59e0b; color: #a16207; background: var(--yellow-bg); }
.step.yellow { border-color: #f59e0b; color: #a16207; }
.step.red { background: #ef4444; border-color: #ef4444; color: #fff; }
.step.grey { border-color: #d1d5db; color: var(--faint); }

.mini-stat { background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.mini-stat .k { font-size: 11px; color: var(--muted); font-weight: 600; }
.mini-stat .v { font-size: 14px; font-weight: 800; }
.bar { height: 6px; background: #eef0f2; border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bar.warn > i { background: #f59e0b; }
.bar.bad > i { background: #ef4444; }

/* ---------- Списки (рядки задач) ---------- */
.rows { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid #f0f1f3; color: inherit; text-decoration: none; }
.row-item:last-child { border-bottom: 0; }
.row-item:hover { background: #fafcfb; color: inherit; }
.row-item .title { font-weight: 600; }
.chk { width: 17px; height: 17px; border-radius: 50%; border: 1.5px solid var(--line-strong); flex-shrink: 0; background: #fff; }
.chk.done { background: var(--accent); border-color: var(--accent); }
.late-text { color: #dc2626; font-weight: 800; white-space: nowrap; font-size: 12px; }
.list-row { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid #f0f1f3; color: inherit; text-decoration: none; }
.list-row:hover { background: #fafcfb; color: inherit; }
.list-row:last-child { border-bottom: 0; }

/* ---------- KPI-плитки ---------- */
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex;
  justify-content: space-between; gap: 10px; box-shadow: var(--shadow); height: 100%; }
.kpi .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi.sm { padding: 8px 12px; }
.kpi.lg { padding: 16px 18px; }
.kpi.lg .k { font-size: 13px; }
.kpi.lg .v { font-size: 28px; }
.kpi.lg .s { font-size: 12px; }
.kpi .cash-split { font-size: 13px; color: var(--muted); max-width: 320px; }
.kpi .cash-split > div { padding: 2px 0; border-top: 1px dashed var(--line); }
.kpi .cash-split b { color: var(--text, #111827); }
.kpi.sm .k { font-size: 11px; }
.kpi.sm .v { font-size: 16px; margin-top: 0; }
.kpi.sm .s { font-size: 10.5px; margin-top: 1px; }
.kpi .v { font-size: 21px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; white-space: nowrap; }
.kpi .s { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.kpi .ic { width: 34px; height: 34px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0; }
.ic.green { background: var(--green-bg); color: var(--green-fg); }
.ic.blue { background: var(--blue-bg); color: var(--blue-fg); }
.ic.red { background: var(--red-bg); color: var(--red-fg); }
.ic.orange { background: var(--orange-bg); color: var(--orange-fg); }
.ic.violet { background: var(--violet-bg); color: var(--violet-fg); }

/* Кругова діаграма структури витрат */
.donut { width: 150px; height: 150px; border-radius: 50%; position: relative; flex-shrink: 0; }
.donut::after { content: ""; position: absolute; inset: 22px; background: #fff; border-radius: 50%; }
.donut .c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 1; }
.donut .c b { font-size: 14px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 6px; }

/* ---------- Картка об'єкта ---------- */
.obj-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 14px; align-items: start; }
.obj-nav { position: sticky; top: 64px; padding: 8px; }
.obj-nav .grp { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 8px 8px 4px; }
.obj-nav a { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 7px; color: #374151; text-decoration: none;
  font-weight: 600; font-size: 13px; }
.obj-nav a i { color: var(--faint); font-size: 15px; }
.obj-nav a:hover { background: #f6f7f9; }
.obj-nav a.on { background: var(--accent-50); color: var(--accent-600); }
.obj-nav a.on i { color: var(--accent); }
.obj-nav a .cnt { margin-left: auto; font-size: 11px; color: var(--faint); font-weight: 700; }
.obj-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 12px; }
.obj-top .t { font-size: 17px; font-weight: 800; }
.budget-line { display: flex; flex-wrap: wrap; gap: 6px; }
.stage-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; box-shadow: var(--shadow); }
.stage-card.is-blocked { border-color: #fca5a5; }
.stage-card.is-late { border-color: #fcd34d; }
.stage-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; }
.stage-head .n { font-weight: 800; font-size: 14px; }
.stage-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); padding: 0 12px 8px 48px; }
.stage-meta b { color: var(--text); }
.stage-tasks { border-top: 1px solid #f0f1f3; padding: 6px 12px 8px 48px; }
.stage-tasks .lbl { font-size: 10.5px; font-weight: 800; color: var(--faint); letter-spacing: .05em; text-transform: uppercase; margin: 4px 0; }
.stask { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 12.5px; color: inherit; text-decoration: none; }
.stask:hover .tt { color: var(--accent-600); }
.stask .tt { flex: 1; min-width: 0; }

/* ---------- Канбан ---------- */
.board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.board-col { background: #eef0f3; border-radius: 10px; min-width: 272px; width: 272px; flex-shrink: 0; border-top: 3px solid var(--faint); }
.board-col.c-grey { border-top-color: #9ca3af; } .board-col.c-blue { border-top-color: #3b82f6; }
.board-col.c-orange { border-top-color: #f59e0b; } .board-col.c-red { border-top-color: #ef4444; }
.board-col.c-green { border-top-color: var(--accent); }
.board-col h6 { padding: 10px 12px 6px; margin: 0; font-weight: 800; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.board-col h6 .cnt { background: #fff; border-radius: 9px; font-size: 11px; padding: 1px 8px; color: var(--muted); }
.board-list { min-height: 90px; padding: 2px 8px 10px; }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; margin-bottom: 7px; cursor: grab;
  display: block; color: inherit; text-decoration: none; box-shadow: var(--shadow); }
.kcard:hover { border-color: #a7d7b8; color: inherit; }
.kcard .title { font-weight: 700; line-height: 1.3; font-size: 13px; }
.kcard.late { box-shadow: inset 3px 0 0 #ef4444, var(--shadow); }
.kcard.ghost { opacity: .4; }
.kcard .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 12px; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo-grid img { width: 100%; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }

.empty-state { text-align: center; color: var(--muted); padding: 36px 16px; }
.empty-state i { font-size: 28px; color: var(--faint); display: block; margin-bottom: 6px; }

.alert { border-radius: 9px; font-size: 13px; }
.table { font-size: 13px; }
.table > :not(caption) > * > * { border-bottom-color: #f0f1f3; }
.table thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; background: #fafbfc; }

/* ---------- Мобільні ---------- */
/* Рядок запису грошей: зверху опис + сума, знизу хто/коли + позначки. Читається на будь-якій ширині */
.mrow { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-top: 1px solid var(--line); background: #fff; }
.mrow:first-child { border-top: 0; }
.mrow-main { flex: 1; min-width: 0; }
.mrow-top, .mrow-sub { display: flex; justify-content: space-between; align-items: center; gap: 4px 10px; flex-wrap: wrap; }
.mrow-title { min-width: 0; flex: 1 1 180px; overflow-wrap: anywhere; }
.mrow-amt { white-space: nowrap; margin-left: auto; }
.mrow-sub { margin-top: 3px; }
.mrow-meta { min-width: 0; flex: 1 1 180px; overflow-wrap: anywhere; }
.mrow-tags { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.team-row { flex-wrap: wrap; row-gap: 6px; }
.cbx-multi > div { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.cbx-multi label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13.5px; }
.cbx-multi input { margin: 0; width: 16px; height: 16px; accent-color: var(--accent, #16a34a); }
.cbx-multi label { padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.cbx-multi label:has(input:checked) { background: var(--accent-50, #ecfdf3); border-color: var(--green-bd, #bbf7d0); font-weight: 600; }
@media (max-width: 576px) {
  .mainnav { gap: 0; }
  .mainnav a { padding: 0 7px !important; }
  .appbar-tools { gap: 4px; }
  .appbar-tools .toolbtn { width: 30px; }
}
@media (max-width: 767px) {
  .team-row .team-name { flex: 1 1 calc(100% - 50px); }
  .team-row .team-name ~ * { margin-left: 0; }
  .team-row .team-name + * { margin-left: 44px; } /* друга лінія — під ім'ям, а не під аватаркою */
}

@media (max-width: 1599px) {
  .appbar .company { display: none; }
  .searchbox input { width: 150px; }
  .mainnav a { padding: 0 9px; }
}
@media (max-width: 1439px) {
  .searchbox { display: none; }
  .mainnav a { padding: 0 6px; gap: 4px; font-size: 12.5px; }
  .mainnav a i { font-size: 14px; }
}
@media (max-width: 1199px) {
  .searchbox { display: none; }
  .company { display: none; }
}
@media (max-width: 991px) {
  body.panel-open .matrix-wrap { grid-template-columns: minmax(0, 1fr); }
  .sidepanel { position: fixed; inset: 52px 0 0 auto; width: min(420px, 100%); max-height: none; z-index: 1040;
    border-radius: 0; box-shadow: var(--shadow-lg); }
  .obj-layout { grid-template-columns: minmax(0, 1fr); }
  .obj-nav { position: static; display: flex; overflow-x: auto; gap: 2px; padding: 4px; }
  .obj-nav .grp { display: none; }
  .obj-nav a { white-space: nowrap; }
  .stage-meta, .stage-tasks { padding-left: 12px; }
}
@media (max-width: 576px) {
  .page { padding: 10px; }
  .brand .name { display: none; }
  .mainnav a span.lbl { display: none; }
}
