@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,300&family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;1,9..144,300;1,9..144,400;1,9..144,600&display=swap');

:root {
  /* Envoren — rocket.new light theme */
  --navy: #071328;
  --navy-light: #0d1d3a;
  --accent: #13A3A6;
  --accent-dark: #0c8a8e;
  --accent-soft: rgba(19,163,166,0.1);
  --mint: #29C178;
  --mint-soft: rgba(41,193,120,0.12);
  --ink: #e2ecff;
  --ink-soft: #a8bbd6;
  --line: rgba(255,255,255,0.08);
  --bg: #071328;
  --bg-2: #0b1a35;
  --card: rgba(255,255,255,0.04);
  --white: #ffffff;
  --green: #22c55e;
  --green-soft: rgba(34,197,94,0.1);
  --green-line: rgba(34,197,94,0.3);
  --amber: #f59e0b;
  --amber-soft: rgba(245,158,11,0.1);
  --amber-line: rgba(245,158,11,0.3);
  --red: #ef4444;
  --red-soft: rgba(239,68,68,0.1);
  --red-line: rgba(239,68,68,0.3);
  --blue-soft: rgba(19,163,166,0.1);
  --blue-line: rgba(19,163,166,0.25);
  --radius: 14px;
  /* Aliases */
  --surface: #0d1a33;
  --border: rgba(255,255,255,0.08);
  --border-2: rgba(255,255,255,0.12);
  --ink-dim: #5c7a9e;
  --slate: #a8bbd6;
  --muted: #5c7a9e;
  --teal-2: #7EE6D6;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0 0 4px; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 17px; margin-top: 22px; }
h3 { font-size: 16px; }
p { margin: 4px 0; }
.hint { color: var(--ink-soft); font-size: 13px; }

/* ---------- Logo mark (stacked, SightBridge-style) ---------- */
.logo-mark { display: flex; flex-direction: column; line-height: 1.05; gap: 2px; }
.logo-line {
  font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase;
}
.logo-line-accent { font-size: 12px; color: var(--accent); }
.logo-line-navy { font-size: 10px; color: var(--navy); opacity: 0.7; }
.logo-line-light { font-size: 10px; color: #b9c6dc; opacity: 0.85; }
.logo-mark-bar { gap: 1px; }

/* ---------- Login ---------- */
#neural-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.centered-view[hidden] { display: none !important; }
.centered-view {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 20%, rgba(19,163,166,0.1) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 70% 80%, rgba(135,201,87,0.07) 0%, transparent 60%);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  padding: 36px 32px 28px;
  text-align: left;
  background: rgba(13,24,52,0.75) !important;
  border: 1px solid var(--border) !important;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 40px rgba(15,31,61,0.1), 0 0 0 1px rgba(19,163,166,0.06);
}
.login-card .logo-mark { margin-bottom: 6px; }
.login-card .logo-line-accent { font-size: 14px; }
.login-card .logo-line-navy { font-size: 11px; }
.login-card .subtitle { color: var(--ink-soft); margin-bottom: 18px; font-size: 14px; font-family: 'Fraunces', Georgia, serif; font-style: italic; }
.login-card label { display: block; font-size: 13px; color: var(--ink-soft); margin-top: 12px; }
.login-card input {
  display: block; width: 100%; margin-top: 6px;
  padding: 11px 12px; border-radius: 10px; border: 1px solid var(--border);
  font-size: 15px; background: rgba(255,255,255,0.06); color: var(--ink);
}
.login-card input::placeholder { color: var(--muted); }
.login-card input:focus { outline: none; border-color: var(--accent); background: rgba(19,163,166,0.06); }
.login-card label { color: var(--ink-soft); }
.login-card .btn { margin-top: 18px; }
.error-text { color: var(--red); font-size: 13px; margin-top: 10px; }
.success-text { color: var(--green); font-size: 13px; margin-top: 10px; }
.auth-switch { margin-top: 14px; font-size: 13px; text-align: center; }
.auth-switch a { color: var(--accent); text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(7,19,40,0.95);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  color: #fff;
  padding: 12px 18px;
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid var(--border);
}

/* ---------- Sidebar nav rail ----------
   Icon-only vertical rail, fixed to the left edge for the full viewport
   height. Hovering a rail icon shows its text label as a tooltip; clicking
   a group icon (Command Center / Plans / Intelligence / Execution) opens a
   flyout listing that group's real tabs. Home and Org Dashboard are
   standalone — clicking navigates directly, same as any other tab. */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 64px; z-index: 21;
  background: rgba(7,19,40,0.97);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--border);
  /* Intentionally no overflow:hidden here — tooltips and flyouts are
     positioned to pop out past the rail's own width and must not be
     clipped by it. */
}
.sidebar-rail {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 14px 0; width: 100%;
}
.rail-group { position: relative; }

.rail-icon-btn {
  position: relative;
  width: 44px; height: 44px; padding: 0; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--ink-soft);
  cursor: pointer; transition: background 0.12s ease, color 0.12s ease;
}
.rail-icon-btn .tab-icon { opacity: 0.85; display: flex; }
.rail-icon-btn .tab-icon svg { width: 20px; height: 20px; }
.rail-icon-btn:hover { background: rgba(19,163,166,0.1); color: var(--navy); }
.rail-icon-btn.active { background: rgba(19,163,166,0.15); color: var(--accent); box-shadow: 0 0 12px rgba(19,163,166,0.1); }
.rail-icon-btn.active:hover { background: rgba(19,163,166,0.2); }
.rail-group.flyout-open .rail-icon-btn { background: rgba(19,163,166,0.12); color: var(--navy); }

/* Hover tooltip with the rail item's text label */
.rail-tooltip {
  position: absolute; left: 56px; top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: var(--navy); color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap;
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border);
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 22;
}
.rail-icon-btn:hover .rail-tooltip,
.rail-icon-btn:focus-visible .rail-tooltip { opacity: 1; transform: translateY(-50%) translateX(0); }
.rail-group.flyout-open .rail-tooltip { opacity: 0 !important; }

/* Click-to-open flyout panel listing a group's real tabs */
.rail-flyout {
  position: absolute; left: 56px; top: 0; min-width: 200px;
  background: rgba(7,19,40,0.97);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 8px; box-shadow: 0 12px 32px rgba(0,0,0,0.4);
  display: flex; flex-direction: column; gap: 2px;
  z-index: 22;
}
.rail-flyout[hidden] { display: none; }
.rail-flyout-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-soft); padding: 4px 10px 6px;
}
.rail-flyout .tab-btn { width: 100%; justify-content: flex-start; }

.tab-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  flex: 0 0 auto; white-space: nowrap;
  border: none; background: transparent; color: var(--ink-soft);
  padding: 10px 14px; border-radius: 12px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background 0.12s ease, color 0.12s ease;
}
.tab-btn .tab-icon { font-size: 13px; opacity: 0.85; }
.tab-btn:hover { background: rgba(19,163,166,0.08); color: var(--navy); }
.tab-btn.active { background: rgba(19,163,166,0.14); color: var(--accent); box-shadow: 0 0 8px rgba(19,163,166,0.1); }
.tab-btn.active:hover { background: rgba(19,163,166,0.2); }

/* Visual separator between groups of icons on the rail */
.rail-sep {
  width: 28px; height: 1px;
  background: var(--border);
  border-radius: 1px;
  margin: 4px 0;
}

/* Everything in the app shell shifts right to clear the fixed rail */
#app-view { padding-left: 64px; box-sizing: border-box; }

/* Home quick-links — the streamlined jump-off points to each consolidated area */
.home-quicklinks {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px; margin: 12px 0 18px;
}
.home-quicklink {
  display: flex; align-items: flex-start; gap: 12px; text-align: left;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; cursor: pointer; transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.home-quicklink:hover { border-color: rgba(19,163,166,0.35); background: rgba(19,163,166,0.04); box-shadow: 0 4px 16px rgba(15,31,61,0.08); }
.hq-icon {
  flex: 0 0 auto; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; background: rgba(19,163,166,0.1); color: var(--accent);
  border: 1px solid rgba(19,163,166,0.2);
}
.hq-icon svg { width: 20px; height: 20px; }
.hq-text { display: flex; flex-direction: column; gap: 2px; }
.hq-label { font-size: 14px; font-weight: 700; color: var(--ink); }
.hq-sub { font-size: 12px; color: var(--ink-soft); }

.content {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 14px 90px;
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 22px;
}
.section-head h2 { margin-top: 0; }

.stack { display: flex; flex-direction: column; gap: 18px; margin-top: 10px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(20, 30, 50, 0.04);
}

.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 8px; }
.metric-card { padding: 14px; text-align: left; }
.metric-label { font-size: 12px; color: var(--ink-soft); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.metric-value { font-size: 26px; font-weight: 700; margin-top: 4px; color: var(--ink); }
.metric-sub { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }

@media (max-width: 560px) {
  .metric-row { grid-template-columns: 1fr; }
}

/* ---------- Graphic dashboard (Visual Insights charts) ---------- */
.chart-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 10px;
}
@media (max-width: 880px) {
  .chart-grid { grid-template-columns: 1fr; }
}
.chart-card { padding: 16px; }
.chart-card-title {
  margin: 0 0 10px; font-size: 14px; font-weight: 700; color: var(--ink);
}
.chart-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.chart-side-note { flex: 1; min-width: 160px; }
.chart-stat { font-size: 14px; color: var(--ink); }
.chart-stat strong { color: var(--ink); }

.chart-legend { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink); }
.chart-legend-item { display: flex; align-items: center; gap: 8px; }
.chart-legend-item strong { margin-left: auto; color: var(--ink); }
.chart-legend-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}

.hbar-chart { display: flex; flex-direction: column; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: 110px 1fr 76px; align-items: center; gap: 10px; }
.hbar-label {
  font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hbar-track {
  height: 10px; border-radius: 999px; background: rgba(255,255,255,0.06); border: 1px solid var(--border); overflow: hidden;
}
.hbar-fill { height: 100%; border-radius: 999px; }
.hbar-value { font-size: 12px; color: var(--ink-soft); text-align: right; white-space: nowrap; }
@media (max-width: 480px) {
  .hbar-row { grid-template-columns: 84px 1fr 64px; }
}

/* ---------- Executive Command Center hero ---------- */
.command-hero {
  background: linear-gradient(165deg, var(--navy) 0%, var(--navy-light) 100%);
  color: #fff;  /* kept dark for contrast */
  border-radius: 18px;
  padding: 24px 22px;
  margin-top: 14px;
}
.hero-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 8px;
}
.hero-title {
  font-size: 28px; font-weight: 300; letter-spacing: -0.01em; margin: 0 0 10px; color: #fff;
}
.hero-accent { font-style: italic; font-weight: 300; color: #b9c6dc; }
.hero-status-line { font-size: 14px; color: #cdd9ec; margin: 0 0 2px; }
.hero-status-word { color: #fff; font-weight: 700; }
.hero-status-word.tone-green { color: #4ade80; }
.hero-status-word.tone-amber { color: #fbbf24; }
.hero-status-word.tone-red { color: #f87171; }
.hero-sub { font-size: 13px; color: #9fb0cb; margin: 0 0 16px; }

.hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.hero-stat {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.hero-stat-value { font-size: 22px; font-weight: 700; color: #fff; }
.hero-stat-value.tone-green { color: #4ade80; }
.hero-stat-value.tone-amber { color: #fbbf24; }
.hero-stat-value.tone-red { color: #f87171; }
.hero-stat-value.tone-accent { color: var(--accent); }
.hero-stat-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: #9fb0cb; margin-top: 3px;
}
@media (max-width: 640px) {
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .hero-title { font-size: 24px; }
}

/* ---------- Four-quadrant intelligence layout ---------- */
.quadrant-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin-top: 16px;
}
@media (max-width: 760px) {
  .quadrant-grid { grid-template-columns: 1fr; }
}
.quadrant {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.quadrant-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase;
  color: var(--ink); margin: 0 0 12px;
}
.dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; }
.dot-red { background: var(--red); }
.dot-green { background: var(--green); }
.dot-amber { background: var(--amber); }
.dot-blue { background: var(--accent); }

/* Color-coded intelligence cards inside quadrants */
.intel-card {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 10px;
  padding: 12px 13px;
  background: rgba(255,255,255,0.05); color: var(--ink);
}
.intel-card + .intel-card { margin-top: 8px; }
.intel-card.tone-red { border-left-color: var(--red); background: var(--red-soft); border-color: var(--red-line); }
.intel-card.tone-green { border-left-color: var(--green); background: var(--green-soft); border-color: var(--green-line); }
.intel-card.tone-amber { border-left-color: var(--amber); background: var(--amber-soft); border-color: var(--amber-line); }
.intel-card.tone-blue { border-left-color: var(--accent); background: var(--blue-soft); border-color: var(--blue-line); }
.intel-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.intel-card-title { font-weight: 700; font-size: 14px; color: var(--ink); }
.intel-card-sub { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.intel-card-meta { font-size: 12px; color: var(--ink-soft); margin-top: 6px; }
.intel-card-link {
  display: inline-block; margin-top: 8px; font-size: 12.5px; font-weight: 700;
  color: var(--accent-dark); cursor: pointer; background: none; border: none; padding: 0;
}
.intel-card-link:hover { text-decoration: underline; }

.intel-card.clickable-card {
  cursor: pointer;
  transition: transform .1s ease, box-shadow .15s ease, border-color .15s ease;
}
.intel-card.clickable-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}
.intel-card.tone-red.clickable-card:hover   { border-color: var(--red); }
.intel-card.tone-green.clickable-card:hover { border-color: var(--green); }
.intel-card.tone-amber.clickable-card:hover { border-color: var(--amber); }
.intel-card.tone-blue.clickable-card:hover  { border-color: var(--accent); }

/* Generic hover → drill-down affordance, applied via JS (_wireDrilldownCards)
   to any metric/KPI/hero-stat card so every numeric widget across every tab
   gets the same "tap for AI insight" behavior as the Reports tab widgets. */
.clickable-card { cursor: pointer; position: relative; outline: none; }
.clickable-card:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.kpi-card.clickable-card, .metric-card.clickable-card, .hero-stat.clickable-card {
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease;
}
.kpi-card.clickable-card:hover, .metric-card.clickable-card:hover, .hero-stat.clickable-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  border-color: var(--accent);
}
.kpi-card.clickable-card::after, .metric-card.clickable-card::after {
  content: "Tap for AI insight →";
  position: absolute; right: 12px; bottom: 8px;
  font-size: 10px; font-weight: 600; color: var(--accent-dark);
  opacity: 0; transition: opacity .15s ease; pointer-events: none;
}
.kpi-card.clickable-card:hover::after, .metric-card.clickable-card:hover::after { opacity: 1; }

.pill {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: 0.04em;
  padding: 3px 9px; border-radius: 100px; text-transform: uppercase; white-space: nowrap;
}
.pill-critical  { background: rgba(248,113,113,0.15); color: #f87171; border: 1px solid rgba(248,113,113,0.3); }
.pill-high-risk { background: rgba(251,191,36,0.12); color: #fbbf24; border: 1px solid rgba(251,191,36,0.25); }
.pill-watch     { background: rgba(251,191,36,0.12); color: #fbbf24; border: 1px solid rgba(251,191,36,0.25); }
.pill-on-track  { background: rgba(34,197,94,0.12); color: var(--green); border: 1px solid rgba(34,197,94,0.25); }
.pill-improving { background: rgba(34,197,94,0.12); color: var(--green); border: 1px solid rgba(34,197,94,0.25); }
.pill-next      { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(19,163,166,0.3); }

.next-action {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 0; border-top: 1px solid var(--line);
}
.next-action:first-child { border-top: none; padding-top: 2px; }
.next-num {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(19,163,166,0.2); color: var(--accent); font-size: 12px; font-weight: 700;
  border: 1px solid rgba(19,163,166,0.35);
  display: flex; align-items: center; justify-content: center;
}
.next-action-body { flex: 1; }
.next-action-title { font-weight: 650; font-size: 14px; color: var(--ink); }
.next-action-sub { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.next-action .btn { flex-shrink: 0; }

/* ---------- Item cards (goals, commitments, recs, recognitions) ---------- */
.item {
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.item-title { font-weight: 650; font-size: 15px; }
.item-meta { font-size: 12.5px; color: var(--ink-soft); }
.item-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

.badge {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
  padding: 3px 9px; border-radius: 100px; text-transform: uppercase;
  white-space: nowrap;
}
.badge-on_track, .badge-complete { background: rgba(34,197,94,0.1); color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.badge-watch, .badge-in_progress, .badge-open { background: rgba(251,191,36,0.1); color: var(--amber); border: 1px solid rgba(251,191,36,0.2); }
.badge-at_risk, .badge-blocked, .badge-delayed, .badge-help_requested { background: rgba(248,113,113,0.1); color: var(--red); border: 1px solid rgba(248,113,113,0.2); }
.badge-pending, .badge-suggested { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(19,163,166,0.25); }
.badge-declined, .badge-dismissed { background: rgba(248,113,113,0.1); color: var(--red); border: 1px solid rgba(248,113,113,0.2); }
.badge-archived { background: rgba(148,163,184,0.12); color: var(--ink-soft); border: 1px solid rgba(148,163,184,0.22); }

.empty-note { color: var(--ink-soft); font-size: 13.5px; padding: 10px 2px; }

.item-top-badges { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* ---------- SMART goal breakdown ---------- */
.smart-breakdown { margin-top: 4px; font-size: 12.5px; }
.smart-breakdown summary {
  cursor: pointer; color: var(--accent); font-weight: 600;
  list-style: none; user-select: none;
}
.smart-breakdown summary::-webkit-details-marker { display: none; }
.smart-breakdown summary::before { content: "▸ "; }
.smart-breakdown[open] summary::before { content: "▾ "; }
.smart-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 7px 0; border-top: 1px solid var(--line);
}
.smart-row-label {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
}
.smart-row-label.filled { background: var(--accent-soft); color: var(--accent); }
.smart-row-label.empty { background: var(--bg-soft, #f1f3f7); color: var(--ink-soft); }
.smart-row-title { font-weight: 650; color: var(--ink); }
.smart-row-value { color: var(--ink-soft); margin-top: 1px; }

/* ---------- Buttons ---------- */
.btn {
  border: none; border-radius: 10px; cursor: pointer;
  font-size: 14px; font-weight: 650; padding: 10px 16px;
  transition: opacity 0.12s ease;
}
.btn:active { opacity: 0.75; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { color: var(--ink); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-outline {
  background: rgba(255,255,255,0.05); color: var(--ink); color: var(--ink); border: 1px solid var(--line);
}

/* topbar's logout should read on dark */
.topbar .btn-ghost { color: #cdd9ec; }
.topbar .btn-ghost:hover { color: #fff; }

/* ---------- AI Insight (goal modal) ---------- */
.goal-insight-row { display: flex; align-items: center; gap: 10px; margin: -2px 0 4px; }
.goal-insight-row .btn { border: 1px solid var(--line); }
.goal-insight-status { font-size: 12px; color: var(--ink-soft); }
.goal-insight-status.is-error { color: var(--red); }
.goal-insight-result {
  background: var(--accent-soft); border: 1px solid rgba(19,163,166,0.25);
  border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--ink-soft);
  margin: -2px 0 10px; line-height: 1.45;
}
.goal-insight-result strong { color: var(--ink); }

/* ---------- Modals ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 40, 0.5);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 50;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  width: 100%; max-width: 480px;
  padding: 20px;
  border-radius: 18px 18px 0 0;
  max-height: 88vh; overflow-y: auto;
  background: rgba(8,16,38,0.97);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
}
@media (min-width: 620px) {
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 16px; }
}
.modal label { display: block; font-size: 13px; color: var(--ink-soft); margin-top: 12px; }
.modal input, .modal select, .modal textarea {
  display: block; width: 100%; margin-top: 6px;
  padding: 10px 11px; border-radius: 9px; border: 1px solid var(--border);
  font-size: 15px; font-family: inherit; background: rgba(255,255,255,0.05); color: var(--ink); resize: vertical;
}
.modal input:focus, .modal select:focus, .modal textarea:focus {
  outline: none; border-color: rgba(19,163,166,0.5); background: rgba(19,163,166,0.07);
}
.modal input::placeholder, .modal textarea::placeholder { color: rgba(180,200,240,0.35); }
.modal .checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); margin-top: 14px; }
.modal .checkbox-row input { width: auto; margin: 0; }
.modal .radio-group { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.modal .radio-group .checkbox-row { margin-top: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-wide { max-width: 640px; }

/* ---- AI-drafted work plan review/edit panel ----------------------------- */

.draft-sme-tag {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; color: var(--accent); background: var(--accent-soft);
  padding: 2px 8px; border-radius: 999px; margin-bottom: 10px;
}
.draft-field { display: block; font-size: 13px; color: var(--ink-soft); margin-top: 12px; }
.draft-field:first-child { margin-top: 0; }
.draft-field input, .draft-field textarea {
  display: block; width: 100%; margin-top: 6px; box-sizing: border-box;
  padding: 10px 11px; border-radius: 9px; border: 1px solid var(--line);
  font-size: 15px; font-family: inherit; background: rgba(255,255,255,0.05); color: var(--ink); resize: vertical;
}
.draft-task-card {
  border: 1px solid var(--border); border-radius: 11px;
  background: rgba(255,255,255,0.03);
  padding: 12px; margin-top: 10px;
}
.draft-task-grid {
  display: grid; grid-template-columns: 1fr; gap: 8px;
}
@media (min-width: 560px) {
  .draft-task-grid { grid-template-columns: 1fr 1fr; }
  .draft-task-grid > .draft-field-desc { grid-column: 1 / -1; }
}
.draft-task-card .draft-field { margin-top: 0; }
.draft-task-card input, .draft-task-card select {
  display: block; width: 100%; margin-top: 4px; box-sizing: border-box;
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  font-size: 14px; font-family: inherit; background: rgba(255,255,255,0.05); color: var(--ink);
}
.draft-subtasks { margin-top: 10px; }
.draft-subtasks-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-soft);
}
.draft-subtask-row, .draft-milestone-row {
  display: flex; align-items: center; gap: 6px; margin-top: 6px;
}
.draft-subtask-row input, .draft-milestone-row input {
  flex: 1; padding: 7px 9px; border-radius: 7px; border: 1px solid var(--line);
  font-size: 13.5px; font-family: inherit; background: rgba(255,255,255,0.05); color: var(--ink);
}
.draft-row-remove {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--line);
  background: rgba(255,255,255,0.05); color: var(--ink); color: var(--ink-soft); font-size: 15px; line-height: 1; cursor: pointer;
}
.draft-row-remove:hover { color: var(--red); border-color: var(--red-line); }
.draft-add-link {
  display: inline-block; margin-top: 8px; font-size: 13px; color: var(--accent);
  background: none; border: none; padding: 0; cursor: pointer; font-family: inherit;
}
.draft-add-link:hover { text-decoration: underline; }
.draft-task-remove { margin-top: 10px; }
.draft-section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-soft); margin-top: 18px; margin-bottom: 4px;
}

/* ---- Inline forms (Intelligence Intake, etc.) -------------------------- */

.stack-form label { display: block; font-size: 13px; color: var(--ink-soft); margin-top: 12px; }
.stack-form label:first-child { margin-top: 0; }
.stack-form input, .stack-form select, .stack-form textarea {
  display: block; width: 100%; margin-top: 6px;
  padding: 10px 11px; border-radius: 9px; border: 1px solid var(--border);
  font-size: 15px; font-family: inherit; background: rgba(255,255,255,0.05); color: var(--ink); resize: vertical;
  box-sizing: border-box;
}
.stack-form input:focus, .stack-form select:focus, .stack-form textarea:focus {
  outline: none; border-color: rgba(19,163,166,0.5); background: rgba(19,163,166,0.07);
}
.stack-form input::placeholder, .stack-form textarea::placeholder { color: rgba(180,200,240,0.35); }
.stack-form select option { background: var(--navy); color: var(--ink); }
.stack-form button { margin-top: 14px; }

/* ---- Signal record cards ------------------------------------------------ */

.signal-card { border-left: 3px solid var(--line); }
.signal-card.kind-upload { border-left-color: var(--accent); }
.signal-card.kind-meeting { border-left-color: var(--accent-dark); }
.signal-card.kind-goal_created,
.signal-card.kind-commitment_created,
.signal-card.kind-work_plan_created { border-left-color: var(--green); }
.signal-kind-tag {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; color: var(--ink-soft); background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 999px; margin-right: 6px;
}
.signal-attachment {
  margin-top: 8px; font-size: 13px; color: var(--ink-soft);
  background: rgba(255,255,255,0.03); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px;
}
.signal-excerpt {
  margin-top: 6px; font-size: 12.5px; color: var(--ink-soft); white-space: pre-wrap;
  max-height: 120px; overflow-y: auto; font-family: ui-monospace, SFMono-Regular, monospace;
  background: rgba(255,255,255,0.05); color: var(--ink); border-radius: 6px; padding: 6px 8px; border: 1px solid var(--line);
}

/* ---- Work Plans ---------------------------------------------------------- */

.alert-card.tone-red {
  border-left: 3px solid var(--red); border-color: var(--red-line);
  background: var(--red-soft); padding: 16px;
}
.recurring-task-card, .person-card { padding: 16px; }
.plan-card { padding: 16px; }
.plan-card.plan-card-mine { box-shadow: inset 3px 0 0 var(--accent); }
.plan-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.plan-name { font-size: 16px; font-weight: 700; color: var(--ink); }
.plan-meta { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.you-tag {
  display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em; color: var(--accent); background: var(--accent-soft);
  border-radius: 999px; padding: 1px 8px; margin-left: 6px; vertical-align: middle;
}

/* Work-plan filter toggle */
.seg-toggle { display: inline-flex; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin: 10px 0 14px; }
.seg-btn {
  border: none; background: transparent; color: var(--ink-soft); font-size: 13px; font-weight: 600;
  padding: 6px 14px; border-radius: 999px; cursor: pointer; transition: background .15s ease, color .15s ease;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.active { background: rgba(19,163,166,0.18); color: var(--accent); box-shadow: 0 0 12px rgba(19,163,166,0.15); border: 1px solid rgba(19,163,166,0.3); }
.plan-section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-soft); margin-top: 16px; margin-bottom: 8px;
}
.plan-task-row, .plan-milestone-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px;
  background: rgba(255,255,255,0.03);
  margin-bottom: 6px; font-size: 14px;
}
.plan-task-row-stack { display: block; }
.plan-task-row-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.plan-subtasks { margin-top: 8px; padding-left: 2px; display: flex; flex-direction: column; gap: 4px; }
.plan-subtask-row { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-soft); cursor: pointer; }
.plan-subtask-row input { width: auto; margin: 0; }
.plan-subtask-done { text-decoration: line-through; color: var(--ink-soft); opacity: .7; }
.plan-task-desc, .plan-milestone-name { font-weight: 600; color: var(--ink); }
.plan-task-meta { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.plan-row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.plan-add-row { margin-top: 8px; }
.plan-empty-note { font-size: 13px; color: var(--ink-soft); font-style: italic; }
.plan-suggestion {
  margin-top: 12px; padding: 11px 13px; border: 1px dashed var(--accent);
  border-radius: 10px; background: var(--accent-soft);
}
.plan-suggestion-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.plan-suggestion-tag {
  display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em; color: #fff; background: var(--accent);
  border-radius: 999px; padding: 2px 9px; flex-shrink: 0;
}
.plan-suggestion-text { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.plan-suggestion-rationale, .plan-suggestion-trigger { font-size: 12.5px; color: var(--ink-soft); margin-top: 4px; }
.plan-suggestion .item-actions { margin-top: 9px; }

/* ---- Meeting Intelligence ------------------------------------------------ */

.meeting-card { padding: 16px; }
.meeting-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.meeting-meta { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.meeting-recap { font-size: 14px; color: var(--ink); margin-top: 10px; line-height: 1.5; }
.action-item-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px;
  background: rgba(255,255,255,0.03);
  margin-bottom: 6px; font-size: 14px;
}

/* ---- Task Management board ----------------------------------------------- */

.task-board {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px; margin-top: 14px;
}
.task-col {
  background: rgba(255,255,255,0.025); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px;
}
.task-col-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-soft); margin-bottom: 10px; display: flex; justify-content: space-between;
}
.task-col-count {
  background: rgba(255,255,255,0.08); color: var(--ink-soft); border-radius: 999px;
  font-size: 11px; padding: 1px 8px;
}
.task-card {
  background: rgba(13,24,52,0.6); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 8px; font-size: 13.5px;
}
.task-card-title { font-weight: 600; color: var(--ink); }
.task-card-meta { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

/* ---------- Chat ---------- */
.chat-thread {
  display: flex; flex-direction: column; gap: 10px;
  min-height: 50vh;
  padding: 6px 2px 14px;
}
.chat-msg {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.42;
  white-space: pre-wrap;
}
.chat-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg.assistant {
  align-self: flex-start;
  background: rgba(255,255,255,0.05); color: var(--ink);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.chat-msg.pending { color: var(--ink-soft); font-style: italic; }

.chat-input-row {
  position: sticky; bottom: 0;
  display: flex; gap: 8px;
  background: var(--bg);
  padding: 10px 0 4px;
}
.chat-input-row input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 100px;
  border: 1px solid var(--line);
  font-size: 15px;
  background: rgba(255,255,255,0.05); color: var(--ink);
}
.chat-input-row .btn { border-radius: 100px; padding: 11px 22px; }

/* ---------- Floating chat (FAB + panel, available on every tab) ---------- */
.chat-fab {
  position: fixed;
  right: 20px; bottom: 80px;
  width: 60px; height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(15, 23, 40, 0.28);
  cursor: pointer;
  z-index: 60;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.chat-fab:hover { transform: scale(1.06); box-shadow: 0 10px 28px rgba(15, 23, 40, 0.34); }
.chat-fab[aria-expanded="true"] { transform: scale(0.92); }
.chat-fab-icon { line-height: 1; transform: translateY(-1px); }

.chat-panel {
  position: fixed;
  right: 28px; bottom: 104px;
  width: min(400px, calc(100vw - 40px));
  height: min(620px, calc(100vh - 150px));
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(15, 23, 40, 0.32);
  display: flex; flex-direction: column;
  overflow: hidden;
  z-index: 59;
  animation: chat-panel-in 0.16s ease-out;
}
.chat-panel[hidden] { display: none; }
@keyframes chat-panel-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.chat-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: var(--accent);
  color: #fff;
  flex-shrink: 0;
}
.chat-panel-title { font-weight: 600; font-size: 15px; }
.chat-panel-close {
  border: none; background: transparent; color: #fff;
  font-size: 16px; line-height: 1; cursor: pointer;
  padding: 4px 6px; border-radius: 6px;
  opacity: 0.85;
}
.chat-panel-close:hover { opacity: 1; background: rgba(255,255,255,0.15); }

.chat-panel .chat-thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px 8px;
}
.chat-panel .chat-input-row {
  padding: 10px 16px 14px;
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.chat-upload-status {
  padding: 0 16px 6px;
  font-size: 12.5px;
}
.chat-attach-btn {
  border-radius: 100px;
  padding: 11px 14px;
  font-size: 17px;
  line-height: 1;
  flex-shrink: 0;
}

@media (max-width: 560px) {
  .chat-fab { right: 18px; bottom: 18px; }
  .chat-panel {
    right: 12px; left: 12px; bottom: 92px;
    width: auto;
  }
}

/* ==== Visual home redesign (additive) ==== */

/* ---- stat strip ---- */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.stat-tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 8px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(13,24,52,0.7);
  backdrop-filter: blur(12px);
  cursor: pointer;
  font-family: inherit;
  transition: transform .1s ease, box-shadow .15s ease, border-color .15s ease;
}
.stat-tile:hover { box-shadow: 0 0 20px rgba(19,163,166,0.12); border-color: rgba(19,163,166,0.25); }
.stat-tile:active { transform: scale(.96); }
.stat-icon { display: flex; align-items: center; justify-content: center; line-height: 1; color: var(--ink-soft); }
.stat-icon svg { width: 20px; height: 20px; }
.stat-num { font-size: 22px; font-weight: 800; color: var(--ink); line-height: 1.1; }
.stat-label { font-size: 10px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; }
.stat-red    { background: rgba(248,113,113,0.08); border-color: rgba(248,113,113,0.25); }
.stat-red    .stat-num  { color: #f87171; }
.stat-red    .stat-icon { color: #f87171; }
.stat-amber  { background: rgba(251,191,36,0.08); border-color: rgba(251,191,36,0.25); }
.stat-amber  .stat-num  { color: #fbbf24; }
.stat-amber  .stat-icon { color: #fbbf24; }
.stat-purple { background: rgba(139,92,246,0.08); border-color: rgba(139,92,246,0.25); }
.stat-purple .stat-num  { color: #a78bfa; }
.stat-purple .stat-icon { color: #a78bfa; }
.stat-orange { background: rgba(249,115,22,0.08); border-color: rgba(249,115,22,0.25); }
.stat-orange .stat-num  { color: #fb923c; }
.stat-orange .stat-icon { color: #fb923c; }
.stat-calm   { background: rgba(13,24,52,0.5); }
.stat-calm   .stat-num  { color: rgba(180,200,240,0.3); }
.stat-calm   .stat-icon { color: rgba(180,200,240,0.25); }

/* ---- visual task cards ---- */
.v-card {
  background: rgba(13,24,52,0.65);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
}
.v-card-collapsed {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.v-card-status-bar {
  width: 4px;
  border-radius: 4px;
  align-self: stretch;
  min-height: 38px;
  flex-shrink: 0;
  background: #94a3b8;
}
.v-card-status-bar.open        { background: var(--accent); }
.v-card-status-bar.in_progress { background: #f59e0b; }
.v-card-status-bar.blocked     { background: #ef4444; }
.v-card-status-bar.delayed     { background: #f97316; }
.v-card-status-bar.complete    { background: #22c55e; }
.v-card-main { flex: 1; min-width: 0; }
.v-card-title {
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.v-card-chips { display: flex; align-items: center; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
.v-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--ink-soft);
  white-space: nowrap;
  border: 1px solid var(--border);
}
.v-chip-blocked  { background: rgba(248,113,113,0.12); color: #f87171; border-color: rgba(248,113,113,0.25); }
.v-chip-delayed  { background: rgba(249,115,22,0.12); color: #fb923c; border-color: rgba(249,115,22,0.25); }
.v-chip-complete { background: rgba(34,197,94,0.12); color: var(--green); border-color: rgba(34,197,94,0.25); }
.v-avatar {
  width: 36px; height: 28px;
  border-radius: 14px;
  background: rgba(19,163,166,0.2);
  color: var(--accent);
  border: 1px solid rgba(19,163,166,0.3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.v-card-done-btn {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  font-family: inherit;
  transition: border-color .15s, background .15s, color .15s;
}
.v-card-done-btn:active { border-color: var(--green); background: rgba(34,197,94,0.12); color: var(--green); }
.v-card-done-btn.complete { border-color: var(--green); background: rgba(34,197,94,0.2); color: var(--green); cursor: default; }
.v-card-chevron {
  font-size: 12px;
  color: rgba(180,200,240,0.3);
  transition: transform .2s;
  flex-shrink: 0;
}
.v-card.is-expanded .v-card-chevron { transform: rotate(180deg); }
.v-card-expanded {
  display: none;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 12px 14px;
}
.v-card.is-expanded .v-card-expanded { display: block; }
.v-card-full-title { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 6px; line-height: 1.4; }
.v-card-secondary-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* links styled as buttons (report downloads) */
a.btn { text-decoration: none; display: inline-flex; align-items: center; }

/* ==== AI Task Completion ==== */
.plan-subtask-ai-pending {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(19,163,166,0.07);
  border: 1px solid rgba(19,163,166,0.25);
  margin: 4px 0;
}
.plan-subtask-ai-header {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.plan-subtask-ai-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
}
.plan-subtask-desc-text {
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
}
.plan-subtask-ai-findings {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
  background: rgba(0,0,0,0.2);
  border-radius: 6px;
  padding: 8px 10px;
  white-space: pre-wrap;
}
.plan-subtask-ai-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.plan-subtask-ai-approved {
  opacity: 0.85;
}
.plan-subtask-ai-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  margin-left: 6px;
  letter-spacing: .04em;
}

/* ==== Date picker — dark theme ==== */
input[type="date"] {
  color-scheme: dark;
  background: rgba(13,24,52,0.8);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
}
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(0.55);
  cursor: pointer;
}
input[type="date"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(19,163,166,0.2);
}

/* ==== Gantt chart — Work Plans timeline view ==== */
.gantt-toggle-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.gantt-toggle-bar .btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

#workplans-gantt {
  overflow-x: auto;
  padding-bottom: 12px;
}

.gantt-wrapper {
  min-width: 700px;
  font-size: 13px;
}

/* Header: month labels */
.gantt-header {
  display: flex;
  margin-left: 180px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 4px;
}
.gantt-month {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 0 6px 6px;
  border-left: 1px solid rgba(255,255,255,0.06);
}

/* Plan section */
.gantt-plan {
  margin-bottom: 20px;
}
.gantt-plan-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 0 0 6px 4px;
}

/* Each row */
.gantt-row {
  display: flex;
  align-items: center;
  height: 30px;
  position: relative;
  border-radius: 4px;
}
.gantt-row:hover { background: rgba(255,255,255,0.02); }

.gantt-row-label {
  width: 180px;
  flex-shrink: 0;
  padding-right: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.gantt-row-name {
  font-size: 12px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gantt-row-owner {
  font-size: 10px;
  color: var(--ink-soft);
}

/* Timeline track */
.gantt-track {
  flex: 1;
  position: relative;
  height: 100%;
}

/* Today line */
.gantt-today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(19,163,166,0.5);
  z-index: 2;
  pointer-events: none;
}
.gantt-today-line::after {
  content: "Today";
  position: absolute;
  top: -16px;
  left: 4px;
  font-size: 10px;
  color: var(--accent);
  white-space: nowrap;
  font-weight: 600;
}

/* Task bars */
.gantt-bar {
  position: absolute;
  top: 6px;
  height: 18px;
  border-radius: 4px;
  min-width: 4px;
  opacity: 0.9;
  transition: opacity .15s;
}
.gantt-bar:hover { opacity: 1; }
.gantt-bar.status-not_started { background: rgba(180,200,240,0.2); border: 1px solid rgba(180,200,240,0.3); }
.gantt-bar.status-in_progress { background: rgba(19,163,166,0.35); border: 1px solid var(--accent); }
.gantt-bar.status-complete    { background: rgba(34,197,94,0.3); border: 1px solid var(--green); }
.gantt-bar.status-blocked     { background: rgba(248,113,113,0.25); border: 1px solid var(--red); }
.gantt-bar.status-delayed     { background: rgba(251,191,36,0.25); border: 1px solid var(--amber); }

/* Milestone diamond */
.gantt-milestone {
  position: absolute;
  top: 5px;
  width: 20px;
  height: 20px;
  transform: translateX(-10px) rotate(45deg);
  border: 2px solid var(--amber);
  background: rgba(251,191,36,0.15);
  z-index: 3;
  border-radius: 3px;
}
.gantt-milestone:hover { background: rgba(251,191,36,0.35); }

.gantt-empty {
  color: var(--ink-soft);
  font-size: 13px;
  padding: 20px 0;
  text-align: center;
}

/* ==== AI Visuals gallery ==== */
#visuals-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.visual-card {
  background: rgba(13,24,52,0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.visual-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.visual-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}

.visual-card-desc {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 3px;
  line-height: 1.4;
}

.visual-card-meta {
  font-size: 11px;
  color: rgba(180,200,240,0.35);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.visual-canvas-wrap {
  position: relative;
  width: 100%;
  /* Chart.js respects this for aspect ratio */
  min-height: 200px;
}

.visual-delete-btn {
  flex-shrink: 0;
  opacity: 0.4;
  transition: opacity .15s;
}
.visual-delete-btn:hover { opacity: 1; }

/* ==== Inline chat charts ==== */
.chat-chart-wrap {
  display: block;
  margin: 10px 0;
  background: rgba(13,24,52,0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  max-width: 100%;
}

.chat-chart-canvas {
  max-height: 280px;
  width: 100% !important;
}

/* ==== Chat file download card ==== */
.chat-file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0;
  padding: 12px 14px;
  background: rgba(13,24,52,0.8);
  border: 1px solid rgba(19,163,166,0.3);
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color .15s, background .15s;
  cursor: pointer;
}
.chat-file-card:hover {
  border-color: var(--accent);
  background: rgba(19,163,166,0.08);
}
.chat-file-icon {
  font-size: 28px;
  flex-shrink: 0;
  line-height: 1;
}
.chat-file-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.chat-file-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.chat-file-name {
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-file-dl {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}

/* ==== File Library ==== */
.lib-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.lib-search-wrap {
  position: relative;
  flex: 1;
  min-width: 180px;
  max-width: 360px;
}
.lib-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-soft);
  pointer-events: none;
}
.lib-search-input {
  width: 100%;
  padding: 7px 12px 7px 32px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}
.lib-search-input:focus {
  border-color: var(--accent);
}
.lib-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.lib-filter-btn {
  padding: 5px 11px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.lib-filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.lib-filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}
.lib-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 14px 12px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: border-color .15s, box-shadow .15s;
}
.lib-card:hover {
  border-color: rgba(19,163,166,0.3);
  box-shadow: 0 2px 12px rgba(19,163,166,0.08);
}
.lib-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.lib-card-body {
  flex: 1;
  min-width: 0;
}
.lib-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}
.lib-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}
.lib-kind-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.lib-card-date,
.lib-card-source {
  font-size: 11px;
  color: var(--ink-soft);
}
.lib-card-excerpt {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.lib-card-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}
.lib-dl-btn,
.lib-preview-btn,
.lib-chat-btn {
  font-size: 11px;
  white-space: nowrap;
  text-decoration: none;
}

/* ---------- Envoren Intelligence Mailbox ---------- */
.intel-address-row {
  display: flex; align-items: center; gap: 10px; margin-top: 8px;
}
.intel-address-row code {
  font-size: 13.5px; background: rgba(255,255,255,0.05);
  border: 1px solid var(--border); border-radius: 7px;
  padding: 6px 10px; color: var(--accent, var(--accent)); flex: 1; min-width: 0;
  overflow-x: auto; white-space: nowrap;
}

.intel-mailbox-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 14px;
  margin-top: 10px;
  align-items: start;
}
.intel-mailbox-list {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 640px; overflow-y: auto;
}
.intel-msg-row {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 13px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.intel-msg-row:hover { border-color: rgba(19,163,166,0.3); }
.intel-msg-row.active {
  border-color: rgba(19,163,166,0.5);
  box-shadow: 0 2px 12px rgba(19,163,166,0.1);
  background: rgba(19,163,166,0.06);
}
.intel-msg-row-top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px;
}
.intel-msg-sender {
  font-size: 12.5px; font-weight: 600; color: var(--ink); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.intel-msg-subject {
  font-size: 13.5px; color: var(--ink); margin-bottom: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.intel-msg-meta { font-size: 11px; color: var(--ink-soft); }

.intel-mailbox-detail {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  min-height: 200px;
}
.intel-detail-head h3 { margin: 0 0 4px; }
.intel-detail-meta {
  font-size: 12.5px; color: var(--ink-soft);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.intel-detail-body {
  margin-top: 14px; font-size: 13.5px; line-height: 1.6; color: var(--ink-soft);
  white-space: normal;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px; max-height: 220px; overflow-y: auto;
}
.intel-extraction { margin-top: 6px; }
.intel-extract-summary {
  font-size: 13.5px; color: var(--ink); line-height: 1.5; margin: 0 0 12px;
}
.intel-extract-group { margin-top: 12px; }
.intel-extract-group h4 {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-soft); margin: 0 0 6px;
}
.intel-extract-group ul { margin: 0; padding-left: 18px; }
.intel-extract-group li { font-size: 13px; color: var(--ink); line-height: 1.5; }

@media (max-width: 800px) {
  .intel-mailbox-layout { grid-template-columns: 1fr; }
  .intel-mailbox-list { max-height: 320px; }
}

/* Library preview modal */
.lib-preview-modal-inner {
  max-width: 700px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.lib-preview-text {
  flex: 1;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  padding: 16px;
  border-radius: 6px;
  margin: 12px 0 0;
  max-height: 60vh;
}

/* ==== Calendar tab ==== */
.cal-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.cal-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  margin: 0;
  min-width: 200px;
  letter-spacing: -.01em;
}
.cal-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.cal-legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.cal-dot-task       { background: var(--accent); }
.cal-dot-commitment { background: var(--green); }
.cal-dot-recurring  { background: #fbbf24; }
.cal-dot-meeting    { background: #a78bfa; }
.cal-dot-milestone  { background: #fb923c; }

/* Grid wrapper */
.cal-grid-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.cal-dow-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
}
.cal-dow-headers span {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 10px 0 9px;
}
.cal-dow-headers span:first-child,
.cal-dow-headers span:last-child {
  color: rgba(167,139,250,0.6); /* weekend tint */
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.cal-loading {
  padding: 40px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
}

/* Day cell */
.cal-cell {
  min-height: 130px;
  padding: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background: var(--card);
  transition: background .12s;
  position: relative;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: rgba(255,255,255,0.025); }
.cal-cell:hover .cal-add-btn { opacity: 1; }
.cal-cell-empty {
  background: rgba(0,0,0,0.12);
  border-right: 1px solid rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.cal-cell-weekend {
  background: rgba(0,0,0,0.08);
}
.cal-cell-today {
  background: rgba(19,163,166,0.07) !important;
}

/* Cell header: day number + add button */
.cal-cell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 8px 4px;
}
.cal-day-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  line-height: 1;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.cal-day-num-today {
  background: var(--accent);
  color: #fff;
  font-size: 12px;
}
.cal-add-btn {
  opacity: 0;
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all .12s;
}
.cal-add-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Chips container */
.cal-chips {
  padding: 0 5px 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}
.cal-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 5px;
  background: var(--chip-bg, rgba(19,163,166,0.18));
  border-left: 3px solid var(--chip-color, var(--accent));
  cursor: pointer;
  transition: filter .12s, transform .1s;
  min-width: 0;
}
.cal-chip:hover {
  filter: brightness(1.15);
  transform: translateX(1px);
}
.cal-chip-icon {
  font-size: 10px;
  color: var(--chip-color, var(--accent));
  flex-shrink: 0;
  line-height: 1;
}
.cal-chip-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.cal-chip-avatar {
  font-size: 9px;
  font-weight: 700;
  background: rgba(255,255,255,0.12);
  color: var(--ink-soft);
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cal-chip.cal-chip-done .cal-chip-text {
  text-decoration: line-through;
  opacity: 0.5;
}
.cal-more-btn {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-soft);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  text-align: left;
  border-radius: 3px;
  transition: color .12s;
}
.cal-more-btn:hover { color: var(--accent); }

/* Calendar event action modal */
.cal-event-modal-inner {
  max-width: 420px;
  width: 100%;
}
.cal-modal-type-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  letter-spacing: .03em;
}
.cal-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin: 12px 0 10px;
  line-height: 1.3;
}
.cal-modal-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 16px;
}
.cal-modal-meta span { display: block; }
.cal-modal-meta strong { color: var(--ink); }
.cal-modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.cal-modal-feedback {
  margin-top: 10px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}
.cal-modal-body {
  padding: 0 20px 20px;
}

/* ==== Org Dashboard ==== */
.orgdb-toolbar {
  margin-bottom: 20px;
}
.orgdb-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.orgdb-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
  margin: 0;
  letter-spacing: -.02em;
}
.orgdb-live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: 20px;
  padding: 3px 10px 3px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: .06em;
}
.orgdb-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: orgdb-pulse 2s infinite;
  flex-shrink: 0;
}
@keyframes orgdb-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.8); }
}
.orgdb-updated {
  font-size: 11px;
  color: var(--ink-soft);
  margin-left: auto;
}

/* Department filter bar */
.orgdb-dept-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.dept-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.dept-btn:hover {
  border-color: var(--dept-color, var(--accent));
  color: var(--dept-color, var(--accent));
}
.dept-btn.active {
  background: var(--dept-color, var(--accent));
  border-color: var(--dept-color, var(--accent));
  color: #fff;
}
.dept-btn[data-dept=''].active { background: var(--accent); border-color: var(--accent); }

/* KPI row */
.orgdb-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
  transition: border-color .15s;
}
.kpi-card:hover { border-color: rgba(19,163,166,0.25); }
.kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .07em;
}
.kpi-value {
  font-size: 36px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.kpi-sub {
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 2px;
}
.kpi-bar-track {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}
.kpi-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 2px;
  transition: width .6s ease;
}
.kpi-alert .kpi-value { color: #fbbf24; }
.kpi-alert-red .kpi-value { color: #f87171; }

/* Charts + sidebar layout */
.orgdb-body {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .orgdb-body { grid-template-columns: 1fr; }
}
.orgdb-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 700px) {
  .orgdb-charts { grid-template-columns: 1fr; }
}
.orgdb-chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  grid-column: span 2;
}
.orgdb-chart-half { grid-column: span 1; }
.orgdb-chart-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 14px;
}
.orgdb-chart-wrap {
  height: 180px;
  position: relative;
}
.orgdb-chart-sm { height: 160px; }

/* Goal progress bars */
.orgdb-goals-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.orgdb-goal-row {}
.orgdb-goal-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.orgdb-goal-title {
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 80%;
}
.orgdb-goal-pct {
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.orgdb-goal-track {
  height: 6px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
}
.orgdb-goal-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .6s ease;
}

/* Sidebar */
.orgdb-sidebar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.orgdb-section-head {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.orgdb-activity {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
}
.orgdb-activity-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.orgdb-activity-icon {
  font-size: 15px;
  flex-shrink: 0;
  margin-top: 1px;
}
.orgdb-activity-body { flex: 1; min-width: 0; }
.orgdb-activity-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.orgdb-activity-excerpt {
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.4;
  margin-top: 1px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.orgdb-activity-time {
  font-size: 10px;
  color: var(--ink-soft);
  opacity: 0.6;
  margin-top: 2px;
}
.orgdb-people-count {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.orgdb-people-num {
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
}
.orgdb-people-label {
  font-size: 13px;
  color: var(--ink-soft);
}

/* ==== Reports Tab ==== */
.rpt-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.rpt-toolbar-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rpt-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}
.rpt-hint {
  font-size: 13px;
  color: var(--ink-dim);
}

/* Widget grid */
.rpt-widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.rpt-widget-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color .15s, box-shadow .15s;
}
.rpt-widget-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.rpt-wcard-icon {
  font-size: 22px;
  line-height: 1;
}
.rpt-wcard-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rpt-wcard-val {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
}
.rpt-wcard-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.rpt-wcard-sub {
  font-size: 11px;
  color: var(--ink-dim);
}

/* Generate card */
.rpt-generate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 24px;
}
.rpt-generate-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.rpt-generate-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

/* Report type pills */
.rpt-type-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.rpt-type-btn {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.rpt-type-btn:hover {
  border-color: var(--accent);
  color: var(--ink);
}
.rpt-type-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.rpt-generate-inputs {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.rpt-generate-inputs label {
  flex: 1;
  min-width: 0;
}
.rpt-generate-inputs input[type="text"] {
  width: 100%;
  margin-top: 4px;
}

/* History */
.rpt-history-head {
  margin-bottom: 10px;
}
.rpt-history-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.rpt-kind-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(19,163,166,.15);
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

/* Widget picker modal */
.rpt-widget-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.rpt-widget-pick-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  user-select: none;
}
.rpt-widget-pick-item input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}
.rpt-widget-pick-item.active,
.rpt-widget-pick-item:has(input:checked) {
  border-color: var(--accent);
  background: rgba(19,163,166,.08);
}
.rpt-widget-pick-icon {
  font-size: 18px;
}
.rpt-widget-pick-label {
  font-size: 13px;
  color: var(--ink);
  flex: 1;
}
.rpt-widget-pick-custom {
  position: relative;
}
.rpt-widget-pick-del {
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  flex-shrink: 0;
}
.rpt-widget-pick-del:hover {
  color: #ef4444;
  background: rgba(239,68,68,.1);
}

/* Suggested widget chips */
.rpt-widget-suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: rgba(19,163,166,.05);
}
.rpt-suggestions-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 2px;
}
.rpt-suggestion-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
}
.rpt-suggestion-chip:hover {
  background: rgba(19,163,166,.08);
}
.rpt-suggestion-icon {
  font-size: 16px;
}
.rpt-suggestion-label {
  font-size: 13px;
  color: var(--ink);
  flex: 1;
}

/* AI-assisted custom widget box */
.rpt-ai-widget-box {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: rgba(126,230,214,0.04);
}
.rpt-ai-widget-label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}
.rpt-ai-widget-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.rpt-ai-widget-row .input {
  flex: 1;
}
.rpt-ai-draft-preview {
  margin-top: 10px;
}
.rpt-ai-draft-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: rgba(19,163,166,.08);
}
.rpt-ai-draft-icon {
  font-size: 20px;
}
.rpt-ai-draft-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.rpt-ai-draft-sub {
  font-size: 12px;
  color: var(--ink-soft);
}
@media (max-width: 480px) {
  .rpt-widget-grid { grid-template-columns: repeat(2, 1fr); }
  .rpt-widget-picker { grid-template-columns: 1fr; }
  .rpt-ai-widget-row { flex-direction: column; }
}

/* ==== Org Chart (clean top-down hierarchy) ==== */
.orgchart-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--ink-soft);
}
.oc-legend-title {
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: .04em;
}
.oc-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.oc-legend-sep {
  width: 1px;
  height: 16px;
  background: var(--line);
  margin: 0 4px;
}
.oc-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.oc-shape {
  width: 9px;
  height: 9px;
  display: inline-block;
  background: var(--mint);
}
.oc-shape-commitment { transform: rotate(45deg); }
.oc-shape-task { border-radius: 2px; }
.oc-shape-goal { border-radius: 50%; clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }

.orgchart-stage {
  position: relative;
  width: 100%;
  height: 560px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: var(--bg);
  background-image: radial-gradient(rgba(255,255,255,0.07) 1px, transparent 1px);
  background-size: 22px 22px;
  touch-action: none;
  cursor: grab;
  user-select: none;
}
.orgchart-stage.oc-dragging { cursor: grabbing; }
.orgchart-plane {
  position: absolute;
  left: 50%;
  top: 24px;
  will-change: transform;
}
.orgchart-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.oc-ctrl-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s, color .15s;
}
.oc-ctrl-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.oc-ctrl-reset { font-size: 13px; }
.orgchart-lines {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.oc-line {
  fill: none;
  stroke: var(--accent);
  stroke-opacity: .4;
  stroke-width: 1.6;
}
.orgchart-nodes {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
}
.orgchart-empty {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  max-width: 320px;
  text-align: center;
}

.oc-node {
  position: absolute;
  left: var(--oc-x);
  top: var(--oc-y);
  transform: translateX(-50%);
  width: 152px;
}
.oc-node-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.oc-node-card:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(19,163,166,.25);
  transform: translateY(-2px);
}
.oc-node-root .oc-node-card {
  border-color: var(--mint);
  background: linear-gradient(160deg, rgba(126,230,214,.14), var(--card));
  box-shadow: 0 2px 10px rgba(126,230,214,.2);
}
.oc-node-card-virtual {
  cursor: default;
  border-style: dashed;
  opacity: .85;
}
.oc-node-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 128px;
}
.oc-node-title {
  font-size: 10.5px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 128px;
}
.oc-node-marks {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 6px;
  max-width: 128px;
}
.oc-mark {
  width: 9px;
  height: 9px;
  background: var(--oc-c, var(--amber));
  flex-shrink: 0;
}
.oc-mark-commitment { transform: rotate(45deg); }
.oc-mark-task { border-radius: 2px; }
.oc-mark-goal { clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.oc-mark-more {
  font-size: 9px;
  color: var(--ink-soft);
  line-height: 9px;
}

.orgchart-popover {
  position: fixed;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  min-width: 180px;
  max-width: calc(100vw - 20px);
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--navy-light);
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  z-index: 50;
}
.oc-pop-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 2px;
}
@media (max-width: 720px) {
  .orgchart-stage { height: 460px; }
}

/* ==== Visual Timeline v2 (SVG-based) ==== */
.tl2-wrapper {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 24px;
}
.tl2-block {
  border-bottom: 1px solid var(--line);
}
.tl2-block:last-child { border-bottom: none; }
.tl2-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.tl2-plan-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.tl2-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}
.tl2-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}
/* Two-column body: fixed labels | scrollable SVG chart */
.tl2-body {
  display: flex;
  align-items: stretch;
}
.tl2-labels {
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.tl2-hdr-label {
  height: 28px;          /* matches SVG HDR_H */
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
}
.tl2-row-label {
  height: 36px;          /* matches SVG ROW_H */
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px 0 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  overflow: hidden;
}
.tl2-row-label:last-child { border-bottom: none; }
.tl2-dot {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.tl2-name {
  font-size: 12px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.tl2-owner {
  font-size: 10px;
  color: var(--ink-soft);
  white-space: nowrap;
  flex-shrink: 0;
}
/* Scrollable chart area */
.tl2-chart-scroll {
  overflow-x: auto;
  flex: 1;
  min-width: 0;
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(19,163,166,0.3) transparent;
}
.tl2-chart-scroll::-webkit-scrollbar { height: 5px; }
.tl2-chart-scroll::-webkit-scrollbar-track { background: transparent; }
.tl2-chart-scroll::-webkit-scrollbar-thumb { background: rgba(19,163,166,0.3); border-radius: 3px; }
.tl2-chart-scroll svg rect:hover { opacity: 1 !important; }

/* ==== Clickable metric widget cards ==== */
.rpt-widget-card {
  cursor: pointer;
  position: relative;
}
.rpt-widget-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 4px 20px rgba(19,163,166,.15);
  transform: translateY(-1px);
  transition: all .15s;
}
.rpt-widget-card:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.rpt-wcard-cta {
  font-size: 10px;
  color: var(--accent);
  margin-top: 6px;
  opacity: 0;
  transition: opacity .15s;
  letter-spacing: .02em;
}
.rpt-widget-card:hover .rpt-wcard-cta { opacity: 1; }

/* ==== Metric Insight Modal ==== */
.metric-insight-modal-inner {
  max-width: 520px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px 22px 20px;
  position: relative;
}
.mi-icon {
  font-size: 32px;
  line-height: 1;
  margin-bottom: 6px;
}
.mi-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.mi-value {
  font-size: 40px;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 16px;
}
.mi-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  color: var(--ink-soft);
  font-size: 13px;
}
.mi-headline {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.55;
  margin: 0 0 14px;
  padding: 12px 14px;
  background: rgba(19,163,166,.07);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
}
.mi-insights-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mi-insight-item {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
  padding-left: 16px;
  position: relative;
}
.mi-insight-item::before {
  content: "·";
  position: absolute;
  left: 4px;
  color: var(--accent);
  font-size: 16px;
  line-height: 1.1;
}
.mi-recs-head {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.mi-recs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mi-rec-card {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mi-rec-urgency {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 2px 8px;
  border-radius: 20px;
  align-self: flex-start;
}
.mi-rec-action {
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.45;
}
.mi-rec-owner {
  font-size: 11px;
  color: var(--ink-soft);
}
.mi-rec-add-btn {
  align-self: flex-start;
  margin-top: 2px;
}

/* ==== Work Plan Goal Selector ==== */
.wp-goal-wrap {
  position: relative;
}
.wp-goal-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 10px;
  overflow: hidden;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  max-height: 200px;
  overflow-y: auto;
}
.wp-goal-opt {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.wp-goal-opt:last-child { border-bottom: none; }
.wp-goal-opt:hover { background: rgba(19,163,166,.12); color: #fff; }

/* ==== Work Plan AI Recommendations ==== */
.wp-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 0;
}
.wp-recs-modal-inner {
  max-width: 580px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.wp-recs-header {
  margin-bottom: 14px;
  flex-shrink: 0;
}
.wp-recs-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 0;
  color: var(--ink-soft);
  font-size: 14px;
}
.wp-recs-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border, var(--line));
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.wp-recs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.wp-rec-card {
  background: rgba(19,163,166,.06);
  border: 1px solid rgba(19,163,166,.18);
  border-radius: 12px;
  padding: 14px;
  cursor: default;
  transition: border-color .15s;
}
.wp-rec-card:hover { border-color: var(--accent); }
.wp-rec-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.wp-rec-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.wp-rec-goal {
  font-size: 12px;
  color: var(--accent);
}
.wp-rec-desc {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 8px;
  line-height: 1.5;
}
.wp-rec-tasks {
  list-style: none;
  padding: 0;
  margin: 0 0 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wp-rec-tasks li {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-soft);
}
.wp-rec-task-dot {
  flex-shrink: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 5px;
}
.wp-rec-task-owner {
  color: var(--ink-soft);
  font-style: italic;
}
.wp-rec-task-due {
  margin-left: auto;
  font-size: 11px;
  color: var(--ink-dim, var(--ink-soft));
  opacity: .7;
}

/* ==== Comprehensive Mobile Fixes ==== */
@media (max-width: 480px) {
  /* Nav */
  .topbar { padding: 10px 12px; }
  .sidebar { width: 52px; }
  #app-view { padding-left: 52px; }
  .rail-icon-btn { width: 38px; height: 38px; }
  .rail-tooltip, .rail-flyout { left: 46px; }
  .rail-flyout .tab-btn { padding: 8px 10px; font-size: 12px; }

  /* Content */
  .content { padding: 12px 10px 100px; }

  /* Hero */
  .hero-title { font-size: 20px; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .hero-stat { padding: 10px 10px; }
  .hero-stat-value { font-size: 18px; }

  /* Quadrants */
  .quadrant-grid { grid-template-columns: 1fr; }

  /* Cards / modals */
  .modal { max-width: 100% !important; margin: 12px !important; padding: 18px 14px !important; }

  /* Section heads */
  .section-head { flex-wrap: wrap; gap: 8px; }
  .section-head h2 { font-size: 15px; }

  /* Item actions — stack on mobile */
  .item-actions { flex-wrap: wrap; gap: 6px; }
  .item-actions .btn { font-size: 12px; padding: 6px 10px; }

  /* Calendar */
  .cal-toolbar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .cal-legend { flex-wrap: wrap; gap: 6px; }
  .cal-cell { min-height: 80px; }
  .cal-chip { padding: 2px 4px; font-size: 10px; }
  .cal-chip-text { display: none; }

  /* Library */
  .lib-grid { grid-template-columns: 1fr; }
  .lib-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }

  /* Reports */
  .rpt-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .rpt-generate-inputs { flex-direction: column; }
  .rpt-type-row { gap: 4px; }
  .rpt-type-btn { font-size: 11px; padding: 4px 9px; }

  /* Org Dashboard */
  .orgdb-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .orgdb-body { grid-template-columns: 1fr; }
  .orgdb-charts { grid-template-columns: 1fr; }
  .orgdb-dept-bar { flex-wrap: wrap; gap: 4px; }
  .dept-btn { font-size: 11px; padding: 4px 10px; }

  /* Work plan AI recs */
  .wp-modal-header { flex-direction: column; align-items: flex-start; }

  /* Timeline */
  .tl2-labels { width: 100px !important; min-width: 100px !important; }
  .tl2-badges { display: none; }
  .tl2-name { font-size: 11px; }
  .tl2-owner { display: none; }

  /* Forms */
  input[type="text"], input[type="email"], input[type="password"],
  input[type="date"], textarea, select {
    font-size: 16px; /* prevent iOS zoom */
  }

  /* Buttons */
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }

  /* Gantt toggle */
  .gantt-toggle-bar { gap: 6px; }
}

@media (max-width: 380px) {
  .tl-label { flex: 0 0 72px; width: 72px; font-size: 10px; }
  .sidebar-rail { gap: 4px; }
}

/* ==== Onboarding / Guided Tour wizard ==== */
.ob-modal-inner {
  max-width: 460px;
  width: 100%;
  padding: 26px 24px 22px;
  position: relative;
}
.ob-progress {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 18px;
}
.ob-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line);
  transition: background .2s, transform .2s;
}
.ob-dot.ob-dot-active { background: var(--accent); transform: scale(1.3); }
.ob-dot.ob-dot-done { background: var(--accent); opacity: .5; }
.ob-skip {
  position: absolute;
  top: 22px;
  right: 22px;
  font-size: 12px;
  color: var(--ink-soft);
  text-decoration: none;
}
.ob-skip:hover { color: var(--ink); text-decoration: underline; }
.ob-step h3 { margin: 0 0 8px; font-size: 19px; }
.ob-step .hint { margin: 0 0 16px; font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
.ob-icon {
  font-size: 30px;
  color: var(--accent);
  margin-bottom: 6px;
}
.hint-inline { font-size: 11px; color: var(--ink-soft); font-weight: 400; }
.ob-existing-goals {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--ink-soft);
}
.ob-existing-goals .ob-goal-chip { display: block; padding: 3px 0; color: var(--ink); }
#ob-add-goal { margin-top: 10px; }
.ob-starter-list {
  list-style: none;
  padding: 0;
  margin: 0 0 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ob-starter-list li {
  font-size: 13px;
  color: var(--ink);
  padding: 10px 12px;
  background: rgba(34,197,94,.06);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  line-height: 1.45;
}
.ob-starter-list .ob-due { display: block; font-size: 11px; color: var(--ink-soft); margin-top: 2px; }

/* ---- AI access (trial / BYO key) — used in onboarding + the paywall modal ---- */
.ai-access-option {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: rgba(255,255,255,.02);
}
.ai-access-option h4 { margin: 0 0 4px; font-size: 14px; color: var(--ink); }
.ai-access-option .hint-inline { display: block; margin-bottom: 10px; }
.ai-access-option input { margin-bottom: 8px; }
.ai-access-divider {
  text-align: center;
  font-size: 11px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 2px 0 10px;
}
.ai-access-status { margin: 8px 0 0; font-size: 12px; }
.ai-access-status.ok { color: var(--accent); }
.ai-access-status.err { color: var(--red); }
.ai-access-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(34,197,94,.07);
  border: 1px solid rgba(34,197,94,.25);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 12px;
}
#ai-paywall-modal .modal { max-width: 440px; }
