﻿/* ==========================================================================
   View-specific styles
   ========================================================================== */

/* In-place refreshes should not replay entrance motion */
.content.quiet .reveal { animation: none; opacity: 1; }
.content.quiet .kpi-spark path { animation: none !important; stroke-dashoffset: 0 !important; }
.content.quiet .evt { animation: none; }
.drawer-body.no-stagger > * { animation: none; }

.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
.kpi-of { font-size: 15px; color: var(--text-3); font-weight: 600; margin-left: 4px; letter-spacing: 0; }

/* ---------- Dashboard ---------- */
.dash-hero {
  display: flex; align-items: stretch; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: 26px 28px; margin-bottom: 18px; overflow: hidden;
  background: linear-gradient(120deg, color-mix(in srgb, var(--primary) 16%, var(--surface)) 0%, var(--surface) 55%);
  border-color: color-mix(in srgb, var(--primary) 25%, var(--border));
}
.hero-glow { position: absolute; right: -80px; top: -120px; width: 380px; height: 380px; border-radius: 50%; background: radial-gradient(circle, rgba(167, 139, 250, .28), transparent 65%); pointer-events: none; animation: glowDrift 9s ease-in-out infinite alternate; }
@keyframes glowDrift { to { transform: translate(-60px, 40px) scale(1.1); } }
.hero-main { position: relative; max-width: 620px; }
.hero-main h2 { font-size: 30px; font-weight: 750; letter-spacing: -.03em; margin: 6px 0 6px; }
.hero-main p b { color: var(--text); font-weight: 600; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.hero-stats { position: relative; display: grid; grid-template-columns: repeat(2, minmax(120px, 1fr)); gap: 10px; align-self: center; }
.hs { display: flex; flex-direction: column; padding: 12px 16px; border-radius: 14px; background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--border); backdrop-filter: blur(6px); transition: transform var(--t) var(--ease), border-color var(--t); }
.hs:hover { transform: translateY(-2px); border-color: var(--primary-ring); }
.hs b { font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hs span { font-size: 12px; color: var(--text-3); }

.dash-row-2 { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); margin-bottom: 18px; }
.dash-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 18px; }
.dash-row-4 { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }

.pr-row { cursor: pointer; border-radius: 10px; padding: 10px 8px; margin: 0 -8px; border-bottom-style: solid; transition: background var(--t-fast); }
.pr-row:hover { background: var(--surface-hover); }
.pr-title { font-weight: 550; font-size: 13.5px; }
.pr-meta { gap: 10px; margin-top: 3px; }

.pulse-row { padding: 9px 8px; margin: 0 -8px; border-radius: 10px; border-bottom-style: solid; transition: background var(--t-fast); }
.pulse-row:hover { background: var(--surface-hover); }
.pulse-row .bar { margin-top: 6px; }

.timeline { position: relative; }
.tl-item { position: relative; display: grid; grid-template-columns: 64px 14px 1fr; gap: 10px; padding-bottom: 16px; }
.tl-item:not(:last-child)::after { content: ''; position: absolute; left: 80px; top: 16px; bottom: -2px; width: 2px; background: var(--border); }
.tl-time { font-size: 11.5px; color: var(--text-3); padding-top: 1px; text-align: right; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 3px; border: 2px solid var(--dot); background: var(--surface); position: relative; z-index: 1; }
.tl-body b { font-size: 13px; font-weight: 600; }
.tl-item.past { opacity: .5; }
.tl-item.past .tl-dot { background: var(--dot); }
.tl-item.live .tl-dot { background: var(--dot); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 25%, transparent); }
.live-dot { animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .3; } }

.notif-row { padding: 10px 8px; margin: 0 -8px; border-radius: 10px; border-bottom-style: solid; transition: background var(--t-fast); }
.notif-row:hover { background: var(--surface-hover); }
.notif-row.unread p { font-weight: 500; }
.notif-row.unread { position: relative; }
.notif-row.unread::after { content: ''; position: absolute; right: 8px; top: 14px; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }

.funnel { display: flex; flex-direction: column; gap: 12px; }
.fn-row { display: grid; grid-template-columns: 92px 1fr 60px 22px; align-items: center; gap: 12px; font-size: 12.5px; }
.fn-label { color: var(--text-2); }
.fn-track { height: 22px; border-radius: 7px; background: var(--surface-2); overflow: hidden; }
.fn-fill { display: block; height: 100%; width: 0; border-radius: 7px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 55%, transparent), var(--c)); transition: width 1100ms var(--ease-out); }
.fn-val { text-align: right; font-weight: 600; }
.fn-n { text-align: right; }

.live-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--success); }
.live-badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulseRing 1.6s infinite; }
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; padding: 9px 0; position: relative; }
.feed-item:not(:last-child)::after { content: ''; position: absolute; left: 13.5px; top: 42px; bottom: -4px; width: 1px; background: var(--border); }
.feed-item p { font-size: 13px; line-height: 1.45; }
.feed-item p b { font-weight: 600; }

/* ---------- Team ---------- */
.team-grid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.member-card { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.mc-top { display: flex; align-items: center; gap: 12px; }
.mc-top h4 { font-size: 15px; font-weight: 650; }
.mc-top p { font-size: 12.5px; }
.mc-load .bar { margin-top: 8px; }
.mc-stats { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.mc-stats div { padding: 10px 12px; display: flex; flex-direction: column; }
.mc-stats div + div { border-left: 1px solid var(--border); }
.mc-stats b { font-size: 17px; font-weight: 700; }
.mc-stats span { font-size: 11px; color: var(--text-3); }
.mc-resp { display: flex; flex-wrap: wrap; gap: 6px; }
.mc-resp .pill { font-weight: 500; }

.profile-hero { display: flex; gap: 18px; align-items: center; }
.profile-hero h3 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.profile-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 22px; }
.profile-stats > div { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 14px 8px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); text-align: center; }
.profile-stats span { font-size: 11.5px; color: var(--text-3); }
.profile-stats .big { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.resp-list { display: grid; gap: 8px; }
.resp { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; }
.resp svg { width: 15px; height: 15px; color: var(--primary); }
.r-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); }
.r-ic svg { width: 15px; height: 15px; }
.kv { display: grid; gap: 10px; }
.kv > div { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.kv svg { width: 16px; height: 16px; color: var(--text-3); }

/* ---------- Tasks ---------- */
.task-stats { display: grid; grid-template-columns: repeat(3, minmax(110px, 160px)) minmax(200px, 1fr); gap: 12px; margin-bottom: 18px; }
.ts { padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.ts span { font-size: 12px; }
.ts b { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.ts-wide { justify-content: center; gap: 10px; }
.ts-wide b { font-size: 14px; }

.board { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 10px; min-height: 200px; transition: background var(--t), border-color var(--t), box-shadow var(--t); }
.col.over { border-color: var(--primary-ring); background: color-mix(in srgb, var(--primary-soft) 60%, var(--surface-2)); box-shadow: inset 0 0 0 1px var(--primary-ring); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; font-size: 13px; }
.col-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.col-dot.blue { background: var(--info); } .col-dot.amber { background: var(--warning); } .col-dot.green { background: var(--success); }
.col-n { font-size: 11.5px; color: var(--text-3); background: var(--surface-3); padding: 1px 7px; border-radius: 10px; }
.col-val { margin-left: auto; font-size: 11.5px; color: var(--text-3); }
.col-add { margin-left: auto; width: 28px; height: 28px; }
.col-add svg { width: 15px; height: 15px; }
.col-body { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.col-empty { border: 1.5px dashed var(--border-strong); border-radius: 12px; padding: 18px; text-align: center; color: var(--text-3); font-size: 12px; }

.tcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 12px 10px; cursor: grab;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease), border-color var(--t), opacity var(--t);
}
.tcard:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
.tcard:active { cursor: grabbing; }
.tcard.dragging { opacity: .35; transform: rotate(-1.5deg) scale(.98); }
.tcard.landed { animation: landed 600ms var(--spring); }
@keyframes landed { 0% { transform: scale(.94); box-shadow: 0 0 0 3px var(--primary-ring); } 100% { transform: none; } }
.tcard h4 { font-size: 13.5px; font-weight: 600; line-height: 1.4; margin: 8px 0 6px; }
.tcard .check { width: 18px; height: 18px; border-radius: 6px; }
.tcard.is-done { opacity: .7; }
.tc-client { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); margin-bottom: 6px; }
.tc-client svg { width: 12px; height: 12px; }
.tc-foot { margin-top: 8px; }
.task-table .grp td { background: var(--surface-2); padding: 8px 16px; }

/* ---------- Schedule ---------- */
.wk-range { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.sched-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.cal { overflow: hidden; }
.cal-scroll { max-height: 700px; overflow: auto; }
.cal-grid { display: grid; grid-template-columns: 58px repeat(7, minmax(124px, 1fr)); grid-template-rows: auto calc(var(--hours) * var(--hh)); min-width: 930px; }
.cal-corner, .cal-dh { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--border); }
.cal-dh { display: flex; flex-direction: column; align-items: center; padding: 12px 4px 10px; gap: 2px; border-left: 1px solid var(--border); }
.cal-dh span { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.cal-dh b { font-size: 19px; font-weight: 650; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; }
.cal-dh.today b { background: var(--grad-brand); color: #fff; box-shadow: 0 6px 16px -6px rgba(124, 58, 237, .8); }
.cal-dh small { height: 18px; font-size: 10.5px; padding: 0 7px; }
.cal-times { display: flex; flex-direction: column; }
.cal-times span { height: var(--hh); font-family: var(--mono); font-size: 10.5px; color: var(--text-3); text-align: right; padding-right: 10px; transform: translateY(-6px); }
.cal-times span:first-child { visibility: hidden; }
.cal-col { position: relative; border-left: 1px solid var(--border); background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hh) - 1px), var(--grid) calc(var(--hh) - 1px), var(--grid) var(--hh)); }
.cal-col.today { background-color: color-mix(in srgb, var(--primary-soft) 40%, transparent); }
.evt {
  position: absolute; z-index: 1; overflow: hidden; text-align: left;
  padding: 6px 8px; border-radius: 9px;
  background: color-mix(in srgb, var(--c) 16%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  border-left: 3px solid var(--c);
  display: flex; flex-direction: column; gap: 1px;
  animation: fadeUp 500ms var(--ease-out) both;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast), z-index 0s;
}
.evt:hover { transform: scale(1.03); z-index: 2; box-shadow: var(--shadow-lg); }
.evt b { font-size: 11.5px; font-weight: 650; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.evt span { font-size: 10.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.evt.tiny { padding: 3px 7px; justify-content: center; }
.evt.tiny span { display: none; }
.evt.past { opacity: .5; }
.now-line { position: absolute; left: 0; right: 0; z-index: 2; height: 2px; background: var(--danger); pointer-events: none; }
.now-line::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 25%, transparent); }
.sched-side { gap: 18px; }
.sched-side .card-head > svg { width: 18px; height: 18px; color: var(--text-3); }
.rem-time { font-size: 12px; font-weight: 600; color: var(--primary); width: 64px; }
.rt-row { width: 100%; border-radius: 10px; padding: 9px 8px; margin: 0; border-bottom-style: solid; transition: background var(--t-fast); }
.rt-row:hover { background: var(--surface-hover); }
.daypicks { display: flex; gap: 6px; }
.daypick input { position: absolute; opacity: 0; pointer-events: none; }
.daypick span { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 12.5px; font-weight: 600; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); cursor: pointer; transition: all var(--t-fast); }
.daypick input:checked + span { background: var(--grad-brand); color: #fff; border-color: transparent; }
.daypick input:focus-visible + span { outline: 2px solid var(--primary-ring); }

/* ---------- Expenses ---------- */
.exp-budget::before { display: none; }
.exp-row { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); margin-bottom: 18px; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; justify-content: center; }
.cat-list { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 2px; }
.cat-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; font-size: 12.5px; text-align: left; transition: background var(--t-fast); }
.cat-row:hover, .cat-row.on { background: var(--surface-hover); }
.cat-row i { width: 10px; height: 10px; border-radius: 3px; }
.cat-row .faint { width: 34px; text-align: right; }
.cat-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 550; color: var(--text-2); white-space: nowrap; }
.cat-pill svg { width: 22px; height: 22px; padding: 4px; border-radius: 7px; color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); }

/* ---------- Clients ---------- */
.client-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.client-card { padding: 20px; }
.client-card h4 { font-size: 15px; font-weight: 650; margin-top: 14px; }
.client-card p { font-size: 12.5px; margin-top: 2px; }
.cc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.cc-stats div { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; }
.cc-stats b { font-size: 14px; }
.proj { padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.proj b { font-size: 13.5px; font-weight: 600; }

/* ---------- Leads ---------- */
.stage-pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: var(--text); background: color-mix(in srgb, var(--c) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 35%, transparent); white-space: nowrap; }
.stage-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
/* Five stages, so each column can breathe instead of being a 220px sliver.
   The funnel and sources cards sit above the board, so it gets the height. */
.pipeline { grid-template-columns: repeat(5, minmax(270px, 1fr)); margin-bottom: 18px; }
.pipeline .col { min-height: 460px; display: flex; flex-direction: column; }
.pipeline .col-head b { font-size: 13.5px; }
.pipeline .col-body { flex: 1; min-height: 120px; }
.pipeline .col-empty { height: 100%; min-height: 120px; display: grid; place-items: center; }
.lc-name { font-size: 13.5px; }
.lc-phone { display: flex; align-items: center; gap: 5px; margin-top: 5px; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.lc-phone svg { width: 12px; height: 12px; }
.pipeline .pill.outline { display: inline-flex; align-items: center; gap: 4px; }
.pipeline .pill.outline svg { width: 11px; height: 11px; }
.pipeline .col { border-top: 3px solid var(--c); }
.lcard { padding: 12px; }
.lc-name { font-size: 13.5px; font-weight: 600; }
.lc-co { font-size: 12px; margin-top: 1px; }
.lc-val { font-size: 14px; }
.score { height: 3px; border-radius: 3px; background: var(--surface-3); margin-top: 10px; overflow: hidden; }
.score span { display: block; height: 100%; background: var(--grad-brand); border-radius: inherit; }
.lead-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.conv { display: flex; flex-direction: column; gap: 10px; }
.conv-row { display: grid; grid-template-columns: 92px 1fr 44px; gap: 12px; align-items: center; font-size: 12.5px; }
.conv-track { position: relative; height: 26px; border-radius: 8px; background: var(--surface-2); }
.conv-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 8px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 50%, transparent), var(--c)); transition: width 1100ms var(--ease-out); }
.conv-track b { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--text); }
.conv-step { text-align: right; }
.stepper { display: flex; gap: 4px; }
.step { flex: 1; display: flex; flex-direction: column; gap: 8px; font-size: 11px; color: var(--text-3); text-align: left; padding: 2px 0; }
.step i { height: 6px; border-radius: 6px; background: var(--surface-3); transition: background var(--t), transform var(--t) var(--spring); }
.step:hover i { transform: scaleY(1.5); }
.step.past i { background: color-mix(in srgb, var(--c) 60%, transparent); }
.step.cur i { background: var(--c); box-shadow: 0 0 12px var(--c); }
.step.cur span { color: var(--text); font-weight: 650; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .dash-row-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-row-3 > :last-child { grid-column: 1 / -1; }
  .sched-layout { grid-template-columns: 1fr; }
  .sched-side { display: grid; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-row-2, .dash-row-4, .exp-row, .lead-row { grid-template-columns: 1fr; }
  .task-stats { grid-template-columns: repeat(3, 1fr); }
  .task-stats .ts-wide { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpi { padding: 14px 16px; }
  .kpi-value { font-size: 22px; }
  .kpi-spark { display: none; }
  .dash-row-3, .sched-side { grid-template-columns: 1fr; }
  .dash-hero { padding: 20px; }
  .hero-main h2 { font-size: 24px; }
  .hero-stats { width: 100%; }
  .page-head h2 { font-size: 22px; }
  .profile-stats { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .toolbar .seg[style*="margin-left:auto"] { margin-left: 0 !important; }
  .search-in { min-width: 0; flex: 1 1 100%; }
  .board { grid-template-columns: repeat(4, 82vw); scroll-snap-type: x mandatory; }
  .pipeline { grid-template-columns: repeat(5, 80vw); }
  .board .col { scroll-snap-align: start; }
}
@media (max-width: 440px) {
  .kpis { grid-template-columns: 1fr; }
  .fn-row { grid-template-columns: 76px 1fr 48px; }
  .fn-n { display: none; }
}
