*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
input, textarea, select, button { font-family: inherit; font-size: inherit; color: inherit; }

:root {
  --black: #000000;
  --dark: #1d1d1f;
  --mid: #2a2a2c;
  --card: rgba(255,255,255,0.05);
  --border: rgba(255,255,255,0.09);
  --border2: rgba(255,255,255,0.05);
  --gray: #6e6e73;
  --light: #86868b;
  --off-white: #f5f5f7;
  --white: #ffffff;
  --blue: #0071e3;
  --blue-light: #2997ff;
  --green: #30d158;
  --orange: #ff9f0a;
  --red: #ff453a;
  --yellow: #ffd60a;
  --purple: #bf5af2;
  --sf: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;

  --dir-ai:            #2997ff;
  --dir-effectiveness: #30d158;
  --dir-learning:      #bf5af2;
  --dir-communications:#ff9f0a;
}

html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: var(--sf);
  background: var(--black);
  color: var(--off-white);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
.hidden { display: none !important; }

/* ── User select ── */
.overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--black); z-index: 100;
}
.user-select-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 22px; padding: 52px 44px; width: 400px; text-align: center;
}
.logo {
  font-size: 36px; font-weight: 700; letter-spacing: -1px;
  background: linear-gradient(90deg, var(--blue-light), #5ac8fa);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 4px;
}
.logo-tagline { font-size: 0.78rem; color: var(--light); margin-bottom: 36px; }
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-btn {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  color: var(--off-white); padding: 13px 16px; cursor: pointer;
  text-align: left; transition: background 0.15s, border-color 0.15s;
  display: flex; align-items: center; gap: 12px;
}
.user-btn:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.18); }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 600; color: #fff; flex-shrink: 0;
}
.user-btn-name { font-weight: 500; font-size: 0.88rem; }
.user-btn-role { font-size: 0.74rem; color: var(--light); margin-top: 2px; }

/* ── Topbar ── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  padding: env(safe-area-inset-top, 0) 24px 0;
  height: calc(48px + env(safe-area-inset-top, 0));
  background: rgba(0,0,0,0.82); backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.logo-small {
  font-size: 17px; font-weight: 600; letter-spacing: -0.3px;
  color: var(--off-white); flex-shrink: 0;
  background: none; border: none; padding: 0; cursor: pointer;
  transition: opacity 0.15s;
}
.logo-small:hover { opacity: 0.8; }
.logo-small em { color: var(--blue-light); font-style: normal; }
.topbar-nav { display: flex; gap: 1px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.topbar-nav::-webkit-scrollbar { display: none; }
.nav-btn {
  background: none; border: none; color: var(--light); padding: 5px 11px; border-radius: 8px;
  font-size: 0.8rem; cursor: pointer; white-space: nowrap;
  transition: color 0.12s, background 0.12s; flex-shrink: 0;
}
.nav-btn:hover { color: var(--off-white); background: rgba(255,255,255,0.07); }
.nav-btn.active { color: var(--off-white); background: rgba(255,255,255,0.1); }
.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
.user-badge { font-size: 0.74rem; color: var(--light); padding: 3px 10px; background: var(--card); border-radius: 20px; border: 1px solid var(--border); }
.btn-ghost { background: none; border: none; color: var(--blue-light); font-size: 0.74rem; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.btn-ghost:hover { background: rgba(41,151,255,0.1); }

/* ── Main — overview mode is full-width ── */
main { padding: 32px 24px 80px; max-width: 1060px; margin: 0 auto; }
main.overview-mode { padding: 0; max-width: none; margin: 0; }

/* Default page colored aura — applies to every view EXCEPT overview */
main { position: relative; }
main:not(.overview-mode)::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 70vh; max-height: 640px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.8;
  background: radial-gradient(ellipse 90% 70% at 50% 0%, rgba(120,100,220,0.35) 0%, transparent 70%);
}
main:not(.overview-mode) > * { position: relative; z-index: 1; }

/* Direction-specific gradients */
main.dir-mode.ai::before            { background: radial-gradient(ellipse 90% 70% at 50% 0%, rgba(41,151,255,0.55) 0%, transparent 70%); }
main.dir-mode.effectiveness::before { background: radial-gradient(ellipse 90% 70% at 50% 0%, rgba(48,209,88,0.45)  0%, transparent 70%); }
main.dir-mode.learning::before      { background: radial-gradient(ellipse 90% 70% at 50% 0%, rgba(191,90,242,0.5)  0%, transparent 70%); }
main.dir-mode.communications::before{ background: radial-gradient(ellipse 90% 70% at 50% 0%, rgba(255,159,10,0.45) 0%, transparent 70%); }

/* Done view — muted blue-green wash */
main.done-mode::before { background: radial-gradient(ellipse 90% 70% at 50% 0%, rgba(48,209,88,0.35) 0%, rgba(41,151,255,0.25) 35%, transparent 70%); }

/* App-info view — purple wash (matches the app icon) */
main.app-mode::before  { background: radial-gradient(ellipse 90% 70% at 50% 0%, rgba(191,90,242,0.5) 0%, transparent 70%); }

/* App-info content */
.page-sub { font-size: 0.95rem; color: var(--light); margin-top: 8px; line-height: 1.55; max-width: 620px; }
.install-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-top: 28px; }
.install-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}
.install-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.install-ico {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.install-ico svg { width: 26px; height: 26px; display: block; }
.install-ico-apple   { background: rgba(255,255,255,0.08); color: #ffffff; }
.install-ico-android { background: rgba(61,220,132,0.15); color: #3ddc84; }
.install-card h3 { font-size: 1rem; font-weight: 600; color: var(--white); margin: 0; }
.install-card ol { padding-left: 18px; margin: 0; }
.install-card li { font-size: 0.88rem; color: var(--off-white); line-height: 1.55; margin-bottom: 10px; }
.install-card li:last-child { margin-bottom: 0; }
.install-card b { font-weight: 600; color: var(--white); }

/* Inline OS-icons inside list items (share, menu dots) */
.os-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  vertical-align: -5px;
  margin: 0 2px;
  border-radius: 5px;
  background: var(--mid);
  border: 1px solid var(--border);
  color: var(--off-white);
}
.os-ico svg { width: 15px; height: 15px; display: block; }
.os-ico-share { color: #2997ff; background: rgba(41,151,255,0.12); border-color: rgba(41,151,255,0.3); }

/* "After install" hint block with branded app icon */
.install-hint {
  margin-top: 28px; padding: 16px;
  display: flex; align-items: center; gap: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.install-hint-icon {
  width: 64px; height: 64px;
  border-radius: 14px;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(191,90,242,0.35);
}
.install-hint-text { font-size: 0.86rem; color: var(--light); line-height: 1.55; }
.install-hint-text b { color: var(--off-white); }
@media (max-width: 560px) {
  .install-hint { flex-direction: column; align-items: flex-start; }
}

/* Big CTA install button on the App-info page */
.install-cta-wrap { margin-top: 22px; margin-bottom: 6px; }
.install-big-btn {
  display: inline-flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #bf5af2 0%, #0071e3 100%);
  color: #fff;
  border: none;
  padding: 14px 24px;
  border-radius: 14px;
  font-size: 1rem; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(191,90,242,0.35);
  transition: transform 0.1s, box-shadow 0.2s, filter 0.2s;
}
.install-big-btn:hover  { filter: brightness(1.08); box-shadow: 0 12px 36px rgba(191,90,242,0.45); }
.install-big-btn:active { transform: scale(0.98); }
.install-big-btn svg { width: 22px; height: 22px; flex-shrink: 0; }

/* Topbar install pill — same look as user-badge */
.install-pill {
  cursor: pointer;
  font-family: inherit;
}
.install-pill:hover { color: var(--off-white); background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.18); }
.install-label-short { display: none; }
@media (max-width: 700px) {
  .install-label-full  { display: none; }
  .install-label-short { display: inline; }
}

/* Non-touch (desktop with mouse): show user name, hide install UI entirely */
body.no-touch #install-topbar-btn,
body.no-touch .nav-btn[data-view="app-info"],
body.no-touch .page-bottom-link { display: none; }

/* Touch devices (phones, iPads): show install UI, hide user name to save space */
body.is-touch #current-user-name { display: none; }

/* Bottom link to "Приложение" — appears on every page */
.page-bottom-link {
  margin-top: 48px;
  padding: 24px 20px 40px;
  border-top: 1px solid var(--border2);
  display: flex; justify-content: center;
}
.page-bottom-link button {
  background: none; border: none; cursor: pointer;
  color: var(--light);
  font-size: 0.82rem; text-align: center; line-height: 1.45;
  padding: 10px 16px; border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}
.page-bottom-link button:hover { color: var(--blue-light); background: rgba(41,151,255,0.08); }
@media (max-width: 700px) {
  .page-bottom-link { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0)); }
}

/* ══════════════════════════════════════
   OVERVIEW — лендинг-брифинг
══════════════════════════════════════ */

/* Hero header */
.ov-hero {
  padding: 52px 24px 40px; max-width: 1060px; margin: 0 auto;
}
.ov-hero > * { opacity: 0; transform: translateY(18px); animation: hero-in 700ms cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.ov-hero > *:nth-child(1) { animation-delay:  80ms; }
.ov-hero > *:nth-child(2) { animation-delay: 170ms; }
.ov-hero > *:nth-child(3) { animation-delay: 260ms; }
.ov-hero > *:nth-child(4) { animation-delay: 350ms; }
@keyframes hero-in { to { opacity: 1; transform: translateY(0); } }

.ov-greeting { font-size: 0.8rem; color: var(--light); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
.ov-title { font-size: clamp(2.8rem, 6vw, 5rem); font-weight: 700; letter-spacing: -2px; color: var(--white); margin-bottom: 8px; line-height: 1.0; }
.ov-date { font-size: 0.85rem; color: var(--light); margin-bottom: 20px; }
.ov-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.ov-chip {
  display: flex; align-items: center; gap: 6px; padding: 6px 14px;
  border-radius: 20px; font-size: 0.8rem; font-weight: 500; border: 1px solid;
}
.ov-chip.problems { color: var(--red); background: rgba(255,69,58,0.1); border-color: rgba(255,69,58,0.25); cursor: pointer; }
.ov-chip.victories { color: var(--yellow); background: rgba(255,214,10,0.1); border-color: rgba(255,214,10,0.25); cursor: pointer; }
.ov-chip.problems:hover { background: rgba(255,69,58,0.2); }
.ov-chip.victories:hover { background: rgba(255,214,10,0.2); }
.ov-chip.num { font-size: 1rem; font-weight: 700; }

/* Flag modal list */
.flag-modal-list { display: flex; flex-direction: column; gap: 0; }
.flag-modal-row { padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.07); cursor: pointer; transition: background .15s; border-radius: 6px; padding: 10px 8px; }
.flag-modal-row:hover { background: rgba(255,255,255,0.05); }
.flag-modal-name { font-size: .9rem; font-weight: 500; color: var(--white); }
.flag-modal-dir { font-size: .74rem; color: var(--gray); margin-top: 2px; }
.flag-modal-text { font-size: .78rem; color: var(--light); margin-top: 5px; }

/* Direction section */
.ov-section {
  border-top: 1px solid var(--border2);
  padding: 52px 24px;
  position: relative; overflow: hidden;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 700ms cubic-bezier(0.22,1,0.36,1), transform 700ms cubic-bezier(0.22,1,0.36,1);
}
.ov-section.visible { opacity: 1; transform: translateY(0); }

/* Cascading reveal for inner elements */
.ov-section .ov-dir-name,
.ov-section .ov-dir-manager,
.ov-section .ov-dir-meta,
.ov-section .ov-dir-flags,
.ov-section .ov-summary-wrap,
.ov-section .ov-card,
.ov-section .ov-section-footer {
  opacity: 0; transform: translateY(16px);
  transition: opacity 600ms cubic-bezier(0.22,1,0.36,1), transform 600ms cubic-bezier(0.22,1,0.36,1);
}
.ov-section.visible .ov-dir-name     { opacity: 1; transform: translateY(0); transition-delay:  80ms; }
.ov-section.visible .ov-dir-manager  { opacity: 1; transform: translateY(0); transition-delay: 160ms; }
.ov-section.visible .ov-dir-meta     { opacity: 1; transform: translateY(0); transition-delay: 220ms; }
.ov-section.visible .ov-dir-flags    { opacity: 1; transform: translateY(0); transition-delay: 260ms; }
.ov-section.visible .ov-summary-wrap { opacity: 1; transform: translateY(0); transition-delay: 320ms; }
.ov-section.visible .ov-card         { opacity: 1; transform: translateY(0); }
.ov-section.visible .ov-card:nth-child(1) { transition-delay: 400ms; }
.ov-section.visible .ov-card:nth-child(2) { transition-delay: 470ms; }
.ov-section.visible .ov-card:nth-child(3) { transition-delay: 540ms; }
.ov-section.visible .ov-card:nth-child(4) { transition-delay: 610ms; }
.ov-section.visible .ov-card:nth-child(5) { transition-delay: 680ms; }
.ov-section.visible .ov-card:nth-child(6) { transition-delay: 750ms; }
.ov-section.visible .ov-section-footer { opacity: 1; transform: translateY(0); transition-delay: 820ms; }

/* Keep the 3rd card faded on mobile even after reveal */
@media (max-width: 700px) {
  .ov-section.visible:not(.expanded) .ov-cards-grid > :nth-child(3) {
    opacity: 0.35;
  }
}

/* Victories section fades in the same way */
.ov-victories {
  opacity: 0; transform: translateY(30px);
  transition: opacity 700ms cubic-bezier(0.22,1,0.36,1), transform 700ms cubic-bezier(0.22,1,0.36,1);
}
.ov-victories.visible { opacity: 1; transform: translateY(0); }
.ov-section::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
}
.ov-section.ai::before      { background: radial-gradient(ellipse 60% 80% at 0% 50%, rgba(41,151,255,0.09) 0%, transparent 70%); }
.ov-section.effectiveness::before { background: radial-gradient(ellipse 60% 80% at 0% 50%, rgba(48,209,88,0.09) 0%, transparent 70%); }
.ov-section.learning::before      { background: radial-gradient(ellipse 60% 80% at 0% 50%, rgba(191,90,242,0.09) 0%, transparent 70%); }
.ov-section.communications::before { background: radial-gradient(ellipse 60% 80% at 0% 50%, rgba(255,159,10,0.09) 0%, transparent 70%); }

.ov-section-inner { max-width: 1060px; margin: 0 auto; position: relative; z-index: 1; }

/* Colored orb per section */
.ov-orb {
  position: absolute; width: 700px; height: 700px; border-radius: 50%;
  filter: blur(130px); top: -250px; left: -280px;
  pointer-events: none; opacity: 0.55;
}
.ov-section.ai .ov-orb            { background: radial-gradient(circle, rgba(41,151,255,0.7) 0%, transparent 65%); }
.ov-section.effectiveness .ov-orb { background: radial-gradient(circle, rgba(48,209,88,0.6) 0%, transparent 65%); }
.ov-section.learning .ov-orb      { background: radial-gradient(circle, rgba(191,90,242,0.6) 0%, transparent 65%); }
.ov-section.communications .ov-orb { background: radial-gradient(circle, rgba(255,159,10,0.6) 0%, transparent 65%); }

/* Grid lines overlay (like landing) */
.ov-section::after {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.022) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 60% 80% at 20% 50%, rgba(0,0,0,0.6) 0%, transparent 100%);
  pointer-events: none;
}

/* Section header row */
.ov-section-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 28px;
}
.ov-section-title-wrap {}

.ov-dir-name {
  font-size: clamp(2.8rem, 6vw, 5rem); font-weight: 700; letter-spacing: -2px;
  color: var(--white); line-height: 1.0; margin-bottom: 8px;
}
.ov-dir-manager {
  font-size: 0.82rem; color: var(--light); margin-bottom: 3px;
}
.ov-dir-meta { font-size: 0.76rem; color: var(--gray); }
.ov-dir-flags { display: flex; gap: 6px; flex-shrink: 0; padding-top: 4px; }
.ov-flag-chip { font-size: 0.72rem; font-weight: 600; padding: 3px 10px; border-radius: 20px; }
.ov-flag-chip.problem { background: rgba(255,69,58,0.15); color: var(--red); }
.ov-flag-chip.star    { background: rgba(255,214,10,0.15); color: var(--yellow); }

/* Editable summary */
.ov-summary-wrap { margin-bottom: 16px; }

.ov-summary {
  font-size: 0.95rem; color: var(--light); line-height: 1.65;
  cursor: text; padding: 8px 10px; border-radius: 8px; margin: -8px -10px;
  border: 1px solid transparent;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}
.ov-summary:hover { border-color: var(--border); background: var(--card); }
.ov-summary:hover::after {
  content: '✎';
  position: absolute; right: 10px; top: 8px;
  font-size: 0.78rem; color: var(--gray);
}
.ov-summary-input {
  width: 100%; background: var(--card); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px; color: var(--off-white); padding: 8px 10px;
  font-size: 0.95rem; line-height: 1.65;
  outline: none; resize: none; min-height: 60px;
}

/* Project cards grid inside overview section */
.ov-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.ov-card {
  background: rgba(255,255,255,0.04);
  height: 138px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ov-card .card-top,
.ov-card .card-meta { flex-shrink: 0; }
.ov-card .card-top   { margin-bottom: 4px; }
.ov-card .card-meta  { margin-bottom: 5px; }
.ov-card .card-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.84rem;
  line-height: 1.32;
}
.ov-card-text {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  font-size: 0.76rem; color: var(--light); line-height: 1.48;
  white-space: pre-wrap; word-break: break-word;
  -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 60%, transparent 100%);
}
.ov-card .card-notext { flex: 1; font-size: 0.74rem; }

.ov-section-footer { display: flex; justify-content: center; margin-top: 4px; }
.ov-expand-btn {
  background: none; border: 1px solid var(--border); border-radius: 20px;
  color: var(--light); font-size: 0.8rem; cursor: pointer; padding: 7px 20px;
  transition: border-color 0.15s, color 0.15s;
}
.ov-expand-btn:hover { border-color: rgba(255,255,255,0.22); color: var(--off-white); }

/* Victories section */
.ov-victories {
  border-top: 1px solid var(--border2);
  padding: 52px 24px 72px;
  background: radial-gradient(ellipse 50% 60% at 50% 100%, rgba(255,214,10,0.07) 0%, transparent 70%);
}
.ov-victories-inner { max-width: 1060px; margin: 0 auto; }
.ov-victories-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--yellow); margin-bottom: 6px; }
.ov-victories-title { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; letter-spacing: -0.4px; color: var(--white); margin-bottom: 28px; }
.ov-victories-list { display: flex; flex-direction: column; gap: 14px; }
.ov-victory-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px 20px; background: rgba(255,214,10,0.06); border: 1px solid rgba(255,214,10,0.15);
  border-radius: 14px; cursor: pointer; transition: background 0.15s;
}
.ov-victory-item:hover { background: rgba(255,214,10,0.1); }
.ov-victory-star { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.ov-victory-body {}
.ov-victory-name { font-size: 0.92rem; font-weight: 600; color: var(--white); margin-bottom: 3px; }
.ov-victory-dir  { font-size: 0.74rem; color: var(--yellow); margin-bottom: 4px; }
.ov-victory-text { font-size: 0.82rem; color: var(--light); line-height: 1.5; }

/* ══════════════════════════════════════
   PROJECT GRID (direction pages)
══════════════════════════════════════ */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }

.project-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; cursor: pointer; transition: border-color 0.15s, transform 0.1s;
}
.project-card:hover { border-color: rgba(255,255,255,0.18); transform: translateY(-1px); }
.project-card.flag-problem { border-left: 3px solid var(--red); }
.project-card.flag-star    { border-left: 3px solid var(--yellow); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-name { font-size: 0.9rem; font-weight: 500; line-height: 1.4; color: var(--white); }
.card-flags { display: flex; gap: 4px; }
.flag-badge { width: 22px; height: 22px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 700; }
.flag-badge.problem { background: rgba(255,69,58,0.15); color: var(--red); }
.flag-badge.star    { background: rgba(255,214,10,0.15); color: var(--yellow); }
.card-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.status-pill { font-size: 0.7rem; font-weight: 500; padding: 2px 9px; border-radius: 20px; }
.status-pill.not_started { background: rgba(255,255,255,0.08); color: var(--light); }
.status-pill.in_progress { background: rgba(41,151,255,0.15); color: var(--blue-light); }
.status-pill.done        { background: rgba(48,209,88,0.15); color: var(--green); }
.status-pill.overdue     { background: rgba(255,69,58,0.15); color: var(--red); }
.card-date { font-size: 0.7rem; color: var(--gray); }
.card-text   { font-size: 0.8rem; color: var(--light); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-notext { font-size: 0.78rem; color: var(--gray); font-style: italic; }
.add-card {
  background: transparent; border: 1px dashed rgba(255,255,255,0.12); border-radius: 14px; padding: 18px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  gap: 8px; color: var(--gray); font-size: 0.82rem; min-height: 100px;
  transition: border-color 0.15s, color 0.15s;
}
.add-card:hover { border-color: rgba(255,255,255,0.22); color: var(--light); }

/* Done projects section at the bottom of direction pages */
.done-section {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--border2);
}
.done-section-title {
  font-size: 1.05rem; font-weight: 600; color: var(--off-white);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.done-count {
  font-size: 0.78rem; font-weight: 500; color: var(--gray);
  background: var(--card); border: 1px solid var(--border);
  padding: 2px 9px; border-radius: 20px;
}
.done-grid .project-card { opacity: 0.72; }
.done-grid .project-card:hover { opacity: 1; }

/* Direction page header */
.dir-page-header { margin-bottom: 28px; }
.back-btn {
  background: none; border: none; color: var(--light); font-size: 0.8rem; cursor: pointer;
  padding: 0 0 12px; display: flex; align-items: center; gap: 5px;
}
.back-btn:hover { color: var(--off-white); }
.dir-page-name-row { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.dir-page-accent { width: 5px; height: 28px; border-radius: 3px; }
.dir-page-accent.ai            { background: var(--dir-ai); }
.dir-page-accent.effectiveness { background: var(--dir-effectiveness); }
.dir-page-accent.learning      { background: var(--dir-learning); }
.dir-page-accent.communications { background: var(--dir-communications); }
.dir-page-title { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.4px; color: var(--white); }
.dir-page-manager { font-size: 0.82rem; color: var(--light); padding-left: 17px; margin-top: 2px; }

/* Stat row */
.stat-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.stat-chip { display: flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 20px; font-size: 0.78rem; border: 1px solid var(--border); background: var(--card); color: var(--light); }
.stat-chip .num { font-weight: 700; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.stat-chip.blue { color: var(--blue-light); background: rgba(41,151,255,0.1); border-color: rgba(41,151,255,0.2); }
.stat-chip.red  { color: var(--red); background: rgba(255,69,58,0.1); border-color: rgba(255,69,58,0.2); }
.stat-chip.yellow { color: var(--yellow); background: rgba(255,214,10,0.1); border-color: rgba(255,214,10,0.2); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.8);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: modal-overlay-in 240ms cubic-bezier(0.22,1,0.36,1);
}
.modal {
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%; max-width: 520px; max-height: 88vh;
  overflow-y: auto;
  padding: 28px 30px;
  animation: modal-in 380ms cubic-bezier(0.22,1,0.36,1);
  transform-origin: center center;
}
@keyframes modal-overlay-in {
  from { opacity: 0; -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); }
  to   { opacity: 1; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.92); filter: blur(14px); }
  to   { opacity: 1; transform: scale(1); filter: blur(0); }
}
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.modal-title { font-size: 1rem; font-weight: 600; line-height: 1.3; color: var(--white); }
.modal-dir { font-size: 0.76rem; color: var(--light); margin-top: 3px; }
.modal-header .modal-close { background: var(--mid); border: none; width: 27px; height: 27px; border-radius: 50%; color: var(--light); cursor: pointer; font-size: 0.88rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.modal-header .modal-close:hover { background: rgba(255,255,255,0.12); }
.form-group { margin-bottom: 16px; }
.form-label { font-size: 0.7rem; color: var(--gray); margin-bottom: 6px; display: block; text-transform: uppercase; letter-spacing: 0.05em; }
.form-input, .form-select, .form-textarea {
  width: 100%; background: var(--mid); border: 1px solid var(--border); border-radius: 10px;
  color: var(--off-white); padding: 9px 12px; font-size: 0.86rem; outline: none;
  transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: rgba(255,255,255,0.28); }
.form-textarea { min-height: 76px; resize: vertical; }
.form-select option { background: var(--mid); }
.flag-picker { display: flex; gap: 7px; }
.flag-option { flex: 1; padding: 8px; background: var(--mid); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; text-align: center; font-size: 0.78rem; color: var(--light); transition: border-color 0.15s, background 0.15s; }
.flag-option:hover { border-color: rgba(255,255,255,0.2); }
.flag-option.sel-none    { border-color: rgba(255,255,255,0.28); color: var(--off-white); }
.flag-option.sel-problem { border-color: var(--red); color: var(--red); background: rgba(255,69,58,0.1); }
.flag-option.sel-star    { border-color: var(--yellow); color: var(--yellow); background: rgba(255,214,10,0.1); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border2); }
.btn-primary, .btn-secondary, .btn-danger {
  border-radius: 10px; padding: 9px 18px; font-size: 0.86rem;
  font-weight: 500; cursor: pointer; border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1.2;
}
.btn-primary   { background: var(--blue); color: #fff; }
.btn-primary:hover   { background: #0077ed; }
.btn-secondary { background: rgba(255,255,255,0.06); color: var(--off-white); border-color: var(--border); }
.btn-secondary:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.18); }
.btn-danger    { background: rgba(255,69,58,0.1); color: var(--red); border-color: rgba(255,69,58,0.25); margin-right: auto; }
.btn-danger:hover    { background: rgba(255,69,58,0.18); border-color: rgba(255,69,58,0.4); }

/* Two inputs on a row */
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; margin-bottom: 16px; }
@media (max-width: 560px) { .form-row { flex-direction: column; gap: 0; } }

/* Timeline */
.history-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border2); }
.history-heading { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gray); margin-bottom: 14px; }
.tl-entry { display: flex; gap: 13px; padding-bottom: 16px; position: relative; }
.tl-entry:not(:last-child)::before { content: ''; position: absolute; left: 6px; top: 16px; bottom: 0; width: 1px; background: var(--border2); }
.tl-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; border: 2px solid var(--black); margin-top: 2px; }
.tl-dot.not_started { background: var(--gray); }
.tl-dot.in_progress { background: var(--blue-light); }
.tl-dot.done        { background: var(--green); }
.tl-dot.overdue     { background: var(--red); }
.tl-body { flex: 1; min-width: 0; }
.tl-meta { font-size: 0.74rem; color: var(--gray); display: flex; align-items: center; gap: 8px; }
.tl-status { font-size: 0.84rem; font-weight: 500; margin-top: 2px; color: var(--off-white); display: flex; align-items: center; gap: 6px; }
.tl-comment { font-size: 0.8rem; color: var(--light); margin-top: 4px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.tl-edit-btn {
  background: none; border: none; color: var(--gray); cursor: pointer;
  padding: 2px 6px; border-radius: 5px; font-size: 0.78rem;
  transition: color 0.15s, background 0.15s;
}
.tl-edit-btn:hover { color: var(--blue-light); background: rgba(41,151,255,0.1); }
.tl-edit-form { display: flex; flex-direction: column; gap: 8px; padding: 10px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 10px; }
.tl-edit-row { display: flex; gap: 6px; flex-wrap: wrap; }
.tl-edit-row .form-select, .tl-edit-row .form-input { flex: 1; min-width: 110px; }
.tl-edit-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.tl-edit-actions .btn-danger { margin-right: auto; font-size: 0.78rem; padding: 6px 10px; }
.tl-edit-actions .btn-primary, .tl-edit-actions .btn-secondary { font-size: 0.78rem; padding: 6px 12px; }

/* Done / Pohvalit */
.page-top { margin-bottom: 28px; }
.page-title { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.4px; color: var(--white); margin-bottom: 16px; }
.filter-row { display: flex; gap: 10px; margin-bottom: 20px; }
.filter-row .form-select { max-width: 200px; }

/* Hamburger button (mobile only — reveals topbar-nav drawer) */
.hamburger {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--off-white);
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  border-radius: 8px; padding: 0;
  transition: background 0.15s;
  flex-shrink: 0;
}
.hamburger:hover  { background: rgba(255,255,255,0.08); }
.hamburger:active { background: rgba(255,255,255,0.12); }

/* Bottom navigation (mobile only) — position-fixed, never resizes on scroll */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 62px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: rgba(0,0,0,0.92);
  backdrop-filter: saturate(180%) blur(24px);
  border-top: 1px solid var(--border);
  z-index: 50;
  /* GPU layer — keeps the element visually stable during iOS Safari chrome show/hide */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: transform;
  flex-shrink: 0;
}
.bnav-btn {
  flex: 1; flex-shrink: 0;
  background: none; border: none;
  color: var(--gray);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; padding: 8px 2px;
  font-size: 0.7rem; font-weight: 500;
  cursor: pointer;
  transition: color 0.12s;
  position: relative;
  min-height: 62px;
}
.bnav-btn svg { width: 24px; height: 24px; display: block; flex-shrink: 0; }
.bnav-btn.active { color: var(--blue-light); }
.bnav-plus svg {
  width: 50px; height: 50px;
  padding: 12px;
  background: var(--blue);
  color: #fff;
  border-radius: 50%;
  margin-top: -20px;
  box-shadow: 0 6px 18px rgba(0,113,227,0.45);
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.bnav-plus:active svg { transform: scale(0.94); }
.bnav-plus:hover svg { background: #0077ed; }

/* Direction picker modal */
.dir-picker { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 2px; }
.dir-picker-btn {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--off-white);
  cursor: pointer; text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.dir-picker-btn:hover { border-color: rgba(255,255,255,0.2); background: rgba(255,255,255,0.08); }
.dir-picker-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dir-picker-dot.ai { background: var(--blue-light); }
.dir-picker-dot.effectiveness { background: var(--green); }
.dir-picker-dot.learning { background: var(--purple); }
.dir-picker-dot.communications { background: var(--orange); }
.dir-picker-name { font-size: 0.92rem; font-weight: 500; color: var(--white); }
.dir-picker-mgr  { font-size: 0.74rem; color: var(--gray); margin-top: 2px; }

/* Profile menu inside modal */
.profile-actions { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.profile-actions button { width: 100%; }

/* ── Mobile ── */
@media (max-width: 700px) {
  .project-grid { grid-template-columns: 1fr; }
  main { padding: 20px 16px calc(82px + env(safe-area-inset-bottom, 0)); }
  .ov-hero { padding: 32px 16px 28px; }
  .ov-section { padding: 36px 16px; }
  .ov-victories { padding: 36px 16px 56px; }
  .ov-watermark { display: none; }
  .ov-section-head { flex-direction: column; gap: 10px; }

  /* Mobile topbar — logo + hamburger + tappable user badge (opens profile) */
  .topbar { padding: env(safe-area-inset-top, 0) 14px 0; }
  .hamburger { display: flex; margin-left: 4px; }
  .topbar-nav { display: none; }
  .topbar-right { display: flex; margin-left: auto; gap: 4px; align-items: center; }
  .user-badge { user-select: none; }
  .user-badge:active { background: rgba(255,255,255,0.12); }
  #switch-user-btn { font-size: 0.72rem; padding: 3px 8px; }

  /* Drawer: floating dropdown — uses position:fixed so its backdrop-filter escapes topbar's filter context */
  .topbar.menu-open .topbar-right { display: none; }
  .topbar.menu-open .topbar-nav {
    display: flex; flex-direction: column; gap: 3px;
    position: fixed;
    top: calc(48px + env(safe-area-inset-top, 0));
    left: 0; right: 0;
    padding: 12px 14px 14px;
    background: rgba(12,12,14,0.9);
    -webkit-backdrop-filter: saturate(180%) blur(40px);
            backdrop-filter: saturate(180%) blur(40px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    z-index: 49;
    animation: drawer-in 260ms cubic-bezier(0.22, 1, 0.36, 1);
  }
  .topbar.menu-open .nav-btn {
    width: 100%; text-align: left;
    padding: 12px 14px;
    font-size: 0.95rem; border-radius: 8px;
    white-space: nowrap;
    animation: nav-item-in 420ms cubic-bezier(0.22, 1, 0.36, 1) backwards;
  }
  .topbar.menu-open .nav-btn:nth-child(1) { animation-delay:  80ms; }
  .topbar.menu-open .nav-btn:nth-child(2) { animation-delay: 130ms; }
  .topbar.menu-open .nav-btn:nth-child(3) { animation-delay: 180ms; }
  .topbar.menu-open .nav-btn:nth-child(4) { animation-delay: 230ms; }
  .topbar.menu-open .nav-btn:nth-child(5) { animation-delay: 280ms; }
  .topbar.menu-open .nav-btn:nth-child(6) { animation-delay: 330ms; }
  @keyframes drawer-in {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  @keyframes nav-item-in {
    from { opacity: 0; transform: translateY(-18px) translateX(-6px); }
    to   { opacity: 1; transform: translateY(0) translateX(0); }
  }

  /* Show bottom nav on mobile */
  .bottom-nav { display: flex; }

  /* Colorful orbs: larger, brighter, positioned into view */
  .ov-orb {
    width: 460px; height: 460px;
    filter: blur(80px);
    top: -90px; left: -70px;
    opacity: 0.8;
  }

  /* Soft direction-tinted wash at the top of each section */
  .ov-section.ai            { background: linear-gradient(to bottom, rgba(41,151,255,0.10) 0%, transparent 38%); }
  .ov-section.effectiveness { background: linear-gradient(to bottom, rgba(48,209,88,0.10) 0%, transparent 38%); }
  .ov-section.learning      { background: linear-gradient(to bottom, rgba(191,90,242,0.10) 0%, transparent 38%); }
  .ov-section.communications{ background: linear-gradient(to bottom, rgba(255,159,10,0.10) 0%, transparent 38%); }

  /* Brighter grid lines on mobile so the tech-feel stays */
  .ov-section::after {
    background-image:
      linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 48px 48px;
  }

  /* Subtle tinted border on cards to emphasize direction color */
  .ov-section.ai            .ov-card { border-color: rgba(41,151,255,0.18); }
  .ov-section.effectiveness .ov-card { border-color: rgba(48,209,88,0.18); }
  .ov-section.learning      .ov-card { border-color: rgba(191,90,242,0.18); }
  .ov-section.communications .ov-card { border-color: rgba(255,159,10,0.18); }

  /* Card a touch more opaque on mobile — better contrast over the tinted bg */
  .ov-card { background: rgba(255,255,255,0.06); }

  /* Mobile preview: 2 full cards + 3rd faded + hide the rest until expanded */
  .ov-section:not(.expanded) .ov-cards-grid > :nth-child(n+4) { display: none; }
  .ov-section:not(.expanded) .ov-cards-grid > :nth-child(3) {
    opacity: 0.35;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent 100%);
            mask-image: linear-gradient(to bottom, #000 40%, transparent 100%);
  }
  /* Expanded: restore everything */
  .ov-section.expanded .ov-cards-grid > :nth-child(n) {
    display: flex; opacity: 1; pointer-events: auto;
    -webkit-mask-image: none; mask-image: none;
  }
}

/* Hide "show all" button on desktop when there's nothing extra to show (mobile-only context) */
@media (min-width: 701px) {
  .ov-section-footer.mobile-only { display: none; }
}
