﻿/* ═══════════════════════════════════════════════════════════════
   BITRIX24-LIKE VISUAL LAYER  —  cascade override block
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. Color tokens ── */
:root {
  --bg:            #f5f7fa;
  --surface:       #ffffff;
  --ink:           #172b4d;
  --ink-muted:     #6b778c;
  --ink-soft:      #8c98a8;
  --line:          #dfe3ea;
  --line-soft:     #edf0f5;
  --b24-blue:      #2fc6f6;
  --b24-blue-dark: #0b8fc9;
  --b24-green:     #9dcf00;
  --b24-orange:    #ffb946;
  --b24-red:       #ff5752;
  --shadow-sm:     0 1px 2px rgba(23,43,77,.08);
  --shadow-md:     0 4px 14px rgba(23,43,77,.08);
}

/* ── 2. System UI font — replace Geist throughout ── */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
/* Remove decorative Fraunces/serif from display elements */
.doc-mark, .hero h1, .legend-title, .change-card-name,
.month-title, .program-name, .deps-map-head h2,
.ghost-btn, .ghost-btn-mini, .filter-toggle-label, .filter-summary,
.quick-view-label, .mode-btn, .hero-kicker, .hero-status-label,
.hero-status-value, .field-label, .card-summary-label, .filter-label,
.section-kicker, .po-proj-status-label, .changes-toggle-btn,
.change-card-stats, .program-roles-slot, .project-name,
.filter-chip, .quick-view-btn {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ── 3. Top nav panel ── */
.doc-top {
  background: rgba(255,255,255,.97);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(23,43,77,.06);
}
.doc-top-inner {
  max-width: none;
  padding: 10px 28px;
  gap: 16px;
}
.doc-mark {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.doc-mark em {
  font-style: normal;
  color: var(--ink-muted);
  font-weight: 500;
}
.doc-meta {
  font-size: 12px;
  gap: 10px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-soft);
}
.doc-meta b { color: var(--ink-muted); font-weight: 500; }
.ghost-btn {
  font-size: 12px;
  border-radius: 6px;
}

/* ── 4. Mode switcher — segmented control ── */
.mode-switcher {
  background: #eef3f8;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
}
.mode-btn {
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  padding: 7px 14px;
}
.mode-btn.active {
  background: var(--b24-blue);
  color: #ffffff;
}
.mode-btn:hover:not(.active) {
  background: rgba(47,198,246,.1);
  color: var(--b24-blue-dark);
}

/* ── 5. Hero — compact page-header ── */
.hero {
  max-width: none;
  padding: 22px 32px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.hero-kicker {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 5px;
}
.hero h1 {
  font-size: 26px;
  line-height: 1.2;
  font-weight: 700;
  margin-bottom: 5px;
  letter-spacing: -0.02em;
}
.hero h1 em { font-style: normal; }
.hero-lede {
  font-size: 14px;
  max-width: 860px;
  color: var(--ink-muted);
  line-height: 1.5;
}
.po-pub-stamp { top: 18px; right: 32px; }

/* ── 6. KPI status bar ── */
.hero-status-bar {
  margin-top: 16px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.hero-status-cell {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px 12px;
}
.hero-status-label {
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}
.hero-status-value { font-size: 13px; font-weight: 500; }
.mode-banner {
  font-size: 12px;
  background: rgba(47,198,246,.08);
  border-color: rgba(47,198,246,.25);
  color: var(--b24-blue-dark);
}

/* ── 7. Changes / legend panel ── */
.changes-toggle-btn {
  font-size: 11px;
  border-color: var(--line);
  color: var(--ink-soft);
  border-radius: 6px;
}
.change-card {
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.change-card-name { font-size: 16px; font-weight: 700; }
.change-card-code { border-radius: 999px; }

/* ── 8. Quick views + filter bar ── */
.quick-views, .filter-bar {
  max-width: none;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.quick-views { padding: 10px 32px; }
.filter-bar { top: 52px; background: rgba(255,255,255,.96); z-index: 100; }
.quick-view-btn, .filter-chip, .ghost-btn-mini {
  border-radius: 999px;
  font-size: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
}
.quick-view-btn.active, .filter-chip.filter-on {
  background: var(--b24-blue);
  border-color: var(--b24-blue);
  color: #ffffff;
}
.filter-chip.filter-on .cf-label { opacity: 1; color: #ffffff; }
.filter-chip.filter-on .role-mark {
  background: rgba(255,255,255,.25);
  color: #ffffff;
}
.filter-search {
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  font-size: 13px;
}
.filter-search:focus {
  outline: none;
  border-color: var(--b24-blue);
  box-shadow: 0 0 0 3px rgba(47,198,246,.15);
}
.filter-reset { font-size: 12px; }

/* ── Search toggle in nav ── */
.nav-search-toggle {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 7px;
  cursor: pointer;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  flex-shrink: 0;
}
.nav-search-toggle:hover { background: var(--bg); color: var(--ink); border-color: var(--b24-blue); }
.nav-search-wrap {
  display: none;
  align-items: center;
  gap: 6px;
}
body.nav-search-open .nav-search-wrap { display: flex; }
body.nav-search-open .nav-search-toggle { display: none; }
body.nav-search-open #btn-print,
body.nav-search-open #btn-deps-map { display: none !important; }
.nav-search-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--ink-muted);
  padding: 4px 7px;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}
.nav-search-close:hover { color: var(--ink); background: var(--bg); }
/* ── Search in nav bar ── */
.nav-search {
  flex: none !important;
  min-width: 0 !important;
  width: 220px;
  padding: 5px 10px;
  font-size: 12.5px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.nav-search:focus {
  border-color: var(--b24-blue);
  box-shadow: 0 0 0 2px rgba(47,198,246,.15);
}
.nav-search::placeholder { color: var(--ink-soft); font-style: italic; }
.nav-search + .search-nav-count { font-size: 11px; color: var(--ink-muted); white-space: nowrap; }
.nav-search ~ .search-nav-btn { padding: 4px 7px; font-size: 11px; height: 28px; }

/* ── 9. Program cards ── */
.program {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.program:hover:not(.is-open) {
  border-color: #b8c4d3;
  box-shadow: var(--shadow-md);
}
.program.is-open {
  border-color: var(--b24-blue);
  box-shadow: var(--shadow-md);
}
.program-head { padding: 12px 16px 12px 18px; gap: 10px; }
.program-name { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.program-kind, .project-kind {
  font-family: "SFMono-Regular", Consolas, monospace;
  text-transform: none;
  letter-spacing: 0;
  border-radius: 999px;
}
.program-kind {
  background: #eefaff;
  color: var(--b24-blue-dark);
  border-color: rgba(11,143,201,.18);
}
.contour-chip {
  border-radius: 999px;
  background: #eef3f8;
  border: 1px solid #d8e0ea;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  text-transform: none;
  letter-spacing: 0;
}
.project-count, .task-badge {
  border-radius: 999px;
  background: #eef3f8;
  border: 1px solid #d8e0ea;
  font-family: "SFMono-Regular", Consolas, monospace;
}

/* ── 10. Status chips — pill style ── */
.status-chip, .status-pill {
  border-radius: 999px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 12px;
  letter-spacing: 0;
  padding: 3px 10px;
}
body[data-mode="edit"] .doc-top { border-bottom: 3px solid var(--b24-orange); }
body[data-mode="edit"] .status-chip[data-action="open-status-menu"] {
  cursor: pointer;
  border-style: solid;
  border-color: rgba(255,185,70,.6);
}
body[data-mode="edit"] .status-chip[data-action="open-status-menu"]:hover {
  outline: 2px solid rgba(255,185,70,.28);
  outline-offset: 2px;
}

/* ── 11. Projects ── */
.project {
  background: #ffffff;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
}
.project.is-open { border-color: var(--b24-blue); }
.project-name { font-size: 14px; font-weight: 600; }
.task-badge-empty {
  background: #eef3f8 !important;
  color: var(--ink-soft) !important;
  border-radius: 999px;
}

/* ── 12. Month nav — narrow, numbers only ── */
.month-nav {
  display: flex !important;
  flex-direction: column;
  z-index: 110;
  right: 12px;
  top: 180px;
  width: 46px;
  padding: 8px 6px;
  background: rgba(255,255,255,.96);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.month-nav-header, .month-nav-count { display: none !important; }
.month-nav-link {
  justify-content: center;
  width: 34px;
  height: 28px;
  padding: 0;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  font-family: "SFMono-Regular", Consolas, monospace;
  color: var(--ink-muted);
}
.month-nav-link:hover { background: #eef3f8; color: var(--ink); }
.month-nav-link.is-current { background: var(--b24-blue); color: #ffffff; }
@media (min-width: 1480px) {
  .timeline { padding-right: 88px; }
  .filter-bar, .quick-views { margin-right: 68px; }
}

/* ── 13. Timeline / months ── */
.timeline { max-width: none; padding: 28px 32px 72px; }
.month { grid-template-columns: 96px 1fr; gap: 20px; padding: 28px 0; }
.month-title { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.month-year { font-style: normal; font-weight: 500; }

/* ── 14. Deps map modal ── */
.deps-map-modal {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(23,43,77,.28);
}
.deps-map-head h2 { font-size: 20px; font-weight: 700; }

/* ── 15. Robust hidden fixes ── */
.deps-map-overlay[hidden], .deps-map-graph[hidden],
.status-menu[hidden], .assignee-menu[hidden] {
  display: none !important;
}

/* ── 16. Month nav dimming when filter active ── */
.month-nav-link.nav-dimmed { opacity: 0.2; pointer-events: none; }

/* ── 17. Project comment field ── */
body:not([data-mode="edit"]) .po-proj-comment.po-comment-empty { display: none; }
.po-proj-comment {
  margin: 0 16px 10px;
  font-size: 12px;
  color: var(--ink-muted);
  line-height: 1.5;
  min-height: 18px;
}
.po-proj-comment:empty::before {
  content: attr(data-placeholder);
  color: var(--ink-soft);
  pointer-events: none;
}
body[data-mode="edit"] .po-proj-comment {
  outline: 1px dashed var(--line);
  border-radius: 4px;
  padding: 4px 6px;
  min-height: 28px;
}

/* ── 18. Search highlight ── */
mark.search-hl {
  background: #fff09e;
  border-radius: var(--radius-sm);
  padding: 0 1px;
  color: inherit;
}
mark.search-hl.search-hl-active {
  background: #ffb946;
  outline: 2px solid #ffb946;
  border-radius: var(--radius-sm);
}
.search-nav-btn {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  color: var(--ink-muted);
  font-family: inherit;
  line-height: 1;
}
.search-nav-btn:hover { background: var(--bg); color: var(--ink); }
.search-nav-count {
  font-size: 11px;
  color: var(--ink-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── 19. Task drag-and-drop ── */
.po-task-drag {
  flex-shrink: 0;
  cursor: grab;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1;
  padding: 1px 2px 1px 0;
  user-select: none;
  display: none;
  align-items: center;
}
body[data-mode="edit"] .po-task-drag { display: flex; }
.po-task-drag:active { cursor: grabbing; }
.po-task-item.po-dragging { opacity: 0.35; }
.po-task-item.po-drag-over { outline: 2px solid var(--b24-blue); border-radius: 4px; }

/* ── 20. Print improvements ── */
@media print {
  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .po-proj-comment, .po-proj-status-row { display: block !important; }
  .project-body { display: block !important; }
  .project-body[hidden] { display: block !important; }
  .project { page-break-inside: avoid; border: 1pt solid #ddd !important; margin-bottom: 2mm !important; }
  .project-head { padding: 2mm 3mm !important; }
  .project-name { font-size: 9pt !important; }
  .timeline { padding: 0 !important; max-width: 100% !important; }
  .hero, .legend-panel, .changes-panel { display: none !important; }
}


