/* ---------- dashboard ---------- */
/* chart series tokens: reference categorical slots 1-3, validated light + dark */
:root { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --bar: #5b4cf5; }
@media (prefers-color-scheme: dark) { :root { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --bar: #7c6dff; } }

.hero { position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center;
  border-radius: 20px; padding: 30px 32px; margin-bottom: 22px; color: #fff;
  background: radial-gradient(circle at 85% 20%, rgba(255, 255, 255, .18), transparent 40%),
              radial-gradient(circle at 10% 110%, #8b5cf6 0%, transparent 55%),
              linear-gradient(135deg, #3b2fd1 0%, #5b4cf5 45%, #8b5cf6 100%);
  box-shadow: 0 14px 40px rgba(91, 76, 245, .28); }
.hero::after { content: ""; position: absolute; right: -60px; bottom: -80px; width: 260px; height: 260px; border-radius: 50%;
  border: 36px solid rgba(255, 255, 255, .06); pointer-events: none; }
.hero-eyebrow { font-size: 13px; font-weight: 600; opacity: .85; letter-spacing: .02em; }
.hero-title { font-size: 30px; line-height: 1.2; margin: 6px 0 8px; letter-spacing: -.02em; }
.hero-title span { color: #e3dcff; }
.hero-sub { margin: 0; opacity: .85; font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hero-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.hero-btn { background: #fff; color: #3b2fd1; border-color: #fff; }
.hero-btn:hover { border-color: #fff; filter: brightness(.96); }
.hero-ghost { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .3); }
.hero-ghost:hover { border-color: #fff; }
.hero-next { position: relative; z-index: 1; min-width: 240px; max-width: 300px; padding: 18px 20px; border-radius: 16px;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22); backdrop-filter: blur(6px);
  display: flex; flex-direction: column; gap: 4px; }
.hero-next-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; opacity: .8; font-weight: 600; }
.hero-count { font-size: 34px; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hero-next-title { font-size: 13px; opacity: .9; overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.kpis { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 22px; }
.kpi { display: flex; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); color: inherit; transition: transform .15s, box-shadow .15s; }
a.kpi:hover { text-decoration: none; transform: translateY(-2px); }
.kpi > div:last-child { min-width: 0; }
.kpi span { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi b { display: block; font-size: 28px; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: #fff; flex: none; }
.kpi-ic svg.i { width: 22px; height: 22px; }
.kpi-ic.g1 { background: linear-gradient(135deg, #2f80ff, #5b4cf5); box-shadow: 0 6px 16px rgba(47, 128, 255, .3); }
.kpi-ic.g2 { background: linear-gradient(135deg, #12b981, #0e9f6e); box-shadow: 0 6px 16px rgba(18, 185, 129, .3); }
.kpi-ic.g3 { background: linear-gradient(135deg, #f59e0b, #ea7a0b); box-shadow: 0 6px 16px rgba(245, 158, 11, .3); }
.kpi-ic.g4 { background: linear-gradient(135deg, #ec4899, #8b5cf6); box-shadow: 0 6px 16px rgba(236, 72, 153, .3); }

.dash-grid { display: grid; gap: 20px; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: stretch; margin-bottom: 20px; }
.dash-grid > .card { margin-bottom: 0; }
.chart-card { position: relative; }
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.chart-head h2 { margin: 0 0 2px; }

/* bar chart: one series, 4px rounded tops on the baseline, 2px gaps, recessive grid */
.bars { position: relative; display: grid; grid-template-columns: repeat(14, 1fr); gap: 2px; height: 210px; padding-left: 26px; }
.bars-grid { position: absolute; left: 26px; right: 0; top: 0; bottom: 40px; pointer-events: none; border-bottom: 1px solid var(--line); }
.bars-grid span { position: absolute; left: -26px; right: 0; transform: translateY(50%); height: 0;
  border-top: 1px dashed var(--line); }
.bars-grid span::before { content: attr(data-v); position: absolute; left: 0; width: 20px; top: -8px; text-align: right;
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; background: var(--panel); }
.bar-col { display: flex; flex-direction: column; align-items: center; position: relative; z-index: 1; border-radius: 8px; }
.bar-col:hover { background: var(--panel-2); }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; padding: 0 3px; }
.bar-track i { display: block; width: 100%; max-width: 26px; border-radius: 4px 4px 0 0; background: var(--bar); opacity: .85;
  transition: height .4s, opacity .15s; }
.bar-col:hover .bar-track i { opacity: 1; }
.bar-x { height: 40px; padding-top: 6px; font-size: 11px; color: var(--muted); text-align: center; line-height: 1.2; }
.bar-x small { font-size: 11px; color: var(--text); font-weight: 600; }
.bar-col.today .bar-x { color: var(--accent); font-weight: 700; }
.chart-tip { position: absolute; transform: translate(-50%, -100%); background: var(--text); color: var(--panel); font-size: 12px;
  font-weight: 600; padding: 6px 10px; border-radius: 8px; white-space: nowrap; pointer-events: none; z-index: 5;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .2); }
.chart-tip[hidden] { display: none; }

/* pipeline: single 100% stacked bar, 2px surface gaps, legend with counts (labels carry identity) */
.stack { display: flex; gap: 2px; height: 16px; border-radius: 99px; overflow: hidden; margin: 18px 0 14px; }
.stack i { display: block; min-width: 4px; }
.stack-legend { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 2px; }
.stack-legend li { display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.stack-legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.stack-legend b { margin-left: auto; font-variant-numeric: tabular-nums; }
.stack-legend em { font-style: normal; color: var(--muted); font-size: 12px; width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.stack-foot { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); padding: 5px 0; }
.stack-foot span { display: flex; gap: 8px; align-items: center; }
.stack-foot b { color: var(--text); font-variant-numeric: tabular-nums; }

.upnext { padding: 6px 0; }
.up-item { display: flex; gap: 14px; align-items: center; padding: 10px 22px; }
.up-item:hover { background: var(--panel-2); }
.up-thumb { position: relative; width: 44px; height: 72px; border-radius: 9px; overflow: hidden; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.up-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.up-thumb span { position: absolute; left: 4px; top: 4px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 11px;
  font-weight: 700; width: 18px; height: 18px; border-radius: 6px; display: grid; place-items: center; }
.up-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.up-text b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-when { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; background: var(--panel-2);
  border: 1px solid var(--line); padding: 4px 10px; border-radius: 99px; }
.up-when.first { color: var(--accent); background: var(--accent-soft); border-color: transparent; }

.section-row { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 14px; }
.proj-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); margin-bottom: 20px; }
.proj-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: inherit;
  box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s, border-color .15s; display: flex; flex-direction: column; }
.proj-card:hover { text-decoration: none; transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 12px 28px rgba(91, 76, 245, .15); }
.proj-cover { position: relative; height: 130px; background: linear-gradient(135deg, #2f80ff, #5b4cf5 60%, #8b5cf6); overflow: hidden; }
.proj-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.proj-cover::after { content: ""; position: absolute; inset: 0; z-index: 2; background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, .45)); }
.proj-initial { position: absolute; inset: 0; display: grid; place-items: center; font-size: 42px; font-weight: 800;
  color: rgba(255, 255, 255, .85); text-transform: uppercase; letter-spacing: -.02em; }
.proj-cover .pill { position: absolute; top: 12px; right: 12px; z-index: 3; background: rgba(255, 255, 255, .92); }
.proj-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; }
.proj-body > b { font-size: 16px; }

@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash-grid { grid-template-columns: 1fr; } }
@media (max-width: 700px) {
  .hero { grid-template-columns: 1fr; padding: 22px 20px; }
  .hero-title { font-size: 23px; }
  .hero-next { max-width: none; }
  .kpis { gap: 12px; }
  .kpi { padding: 14px; flex-direction: column; align-items: flex-start; }
  .kpi b { font-size: 24px; }
  .bars { height: 180px; padding-left: 22px; }
  .bar-x { font-size: 9px; }
  .bar-x small { font-size: 10px; }
}

/* wide screens: use the room instead of leaving empty sides */
@media (min-width: 1500px) {
  .dash-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .bars { height: 240px; }
  .hero { padding: 34px 40px; }
  .hero-title { font-size: 34px; }
  .proj-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}
.bars-empty { position: absolute; inset: 0 0 40px 26px; display: grid; place-items: center; z-index: 2; pointer-events: none; }
.bars-empty div { background: var(--panel); border: 1px dashed var(--line); border-radius: 12px; padding: 12px 18px;
  text-align: center; font-size: 13px; color: var(--muted); }
.bars-empty b { display: block; color: var(--text); font-size: 14px; margin-bottom: 2px; }

/* analytics: horizontal bars (single series) + daily trend */
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 2fr) auto; gap: 12px; align-items: center; font-size: 13px; }
.hbar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.hbar-track { height: 14px; background: var(--panel-2); border-radius: 0 4px 4px 0; overflow: hidden; }
.hbar-track i { display: block; height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar b { font-variant-numeric: tabular-nums; min-width: 48px; text-align: right; }
.trend { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; height: 220px; }
.trend-col { display: flex; flex-direction: column; align-items: center; border-radius: 8px; }
.trend-col:hover { background: var(--panel-2); }
