/* Marketing page, plus the shared charts (.ch-*) used by Dashboard and Marketing. Tokens only, see base.css. */

/* ---------- period picker ---------- */
.ch-period { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.ch-period .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.ch-period .seg button { min-height: 34px; white-space: nowrap; }
.ch-custom { display: flex; align-items: center; gap: 6px; }
.ch-custom .input { width: 150px; min-height: 36px; padding: 6px 8px; }
.ch-custom:not(.on) .input { color: var(--muted); }

/* ---------- charts ---------- */
.ch-empty { padding: 24px 0; text-align: center; }
.ch-bars { margin: 0; }
.ch-legend { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; flex-wrap: wrap; }
.ch-key { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.ch-key-b { margin-left: 10px; }
.ch-key-a, .ch-a { background: color-mix(in srgb, var(--faint) 45%, transparent); fill: color-mix(in srgb, var(--faint) 45%, transparent); }
.ch-key-b, .ch-b { background: var(--good); fill: var(--good); }
.ch-plot { display: grid; grid-template-columns: 30px 1fr; gap: 6px; }
.ch-y { position: relative; height: var(--h, 190px); font-size: 11.5px; color: var(--faint); }
.ch-y span { position: absolute; right: 0; transform: translateY(50%); line-height: 1; }
.ch-area { height: var(--h, 190px); position: relative; }
.ch-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.ch-grid { stroke: var(--line-soft); stroke-width: 1; }
.ch-hit { fill: transparent; }
.ch-svg g:hover .ch-hit { fill: color-mix(in srgb, var(--faint) 12%, transparent); }
.ch-x { position: relative; height: 20px; margin: 6px 0 0 36px; font-size: 11.5px; color: var(--muted); }
.ch-x span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }

.ch-hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ch-hbars li { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; align-items: center; gap: 10px; min-height: 24px; }
.ch-hl { font-size: 13px; }
.ch-track { height: 10px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.ch-fill { display: block; height: 100%; background: color-mix(in srgb, var(--muted) 70%, transparent); border-radius: 3px; }
.ch-hv { font-size: 13px; font-weight: 600; text-align: right; white-space: nowrap; min-width: 28px; }
.ch-hv .faint { font-weight: 500; }

.ch-spark { display: block; width: 72px; height: 26px; color: var(--muted); }
.ch-cell { display: inline-block; width: 48px; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; vertical-align: middle; }
.ch-cell span { display: block; height: 100%; background: color-mix(in srgb, var(--muted) 60%, transparent); }

/* column chart (CRM.charts.columns): leads soft, customers solid, both in the navy ink */
.ch-cols { margin: 0; --ch-a: color-mix(in srgb, var(--ink) 26%, var(--surface)); --ch-b: var(--ink); }
.ch-ka { background: var(--ch-a); }
.ch-kb { background: var(--ch-b); }
.ch-cplot { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 8px; padding-bottom: 22px; }
.ch-cy { position: relative; height: var(--h, 210px); font-size: 11.5px; color: var(--faint); }
.ch-cy span { position: absolute; right: 0; transform: translateY(50%); line-height: 1; }
.ch-carea { position: relative; height: var(--h, 210px); }
.ch-cgrid { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--line-soft); }
.ch-cgrid.ch-base { border-top-color: var(--line); }
.ch-ccols { position: absolute; inset: 0; display: flex; align-items: stretch; }
.ch-col { position: relative; flex: 1 1 0; min-width: 0; display: flex; justify-content: center; }
.ch-col:hover { background: color-mix(in srgb, var(--faint) 10%, transparent); }
.ch-cbars { display: flex; align-items: flex-end; justify-content: center; gap: 2px; width: 76%; max-width: 30px; height: 100%; }
.ch-cb { flex: 1 1 0; min-width: 0; max-width: 13px; border-radius: 3px 3px 0 0; }
.ch-ca { background: var(--ch-a); }
.ch-cbb { background: var(--ch-b); }
.ch-cx { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); padding-top: 6px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.ch-tip { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 2; display: none; padding: 6px 9px; border-radius: var(--r-ctl);
  background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow-pop); font-size: 12.5px; white-space: nowrap; pointer-events: none; }
.ch-tip-l { left: 0; transform: none; }
.ch-tip-r { left: auto; right: 0; transform: none; }
.ch-col:hover .ch-tip { display: block; }
.ch-cols .ch-legend { margin-bottom: 26px; }

/* today at a glance */
.td-glance { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 4px; padding: 8px 10px; }
.td-gl { display: flex; align-items: baseline; gap: 8px; padding: 6px 12px; border-radius: var(--r-ctl); color: inherit; text-decoration: none; min-height: 36px; }
a.td-gl:hover { background: var(--surface-2); }
.td-gl + .td-gl { border-left: 1px solid var(--line-soft); border-radius: 0; }
.td-gl-n { font-size: 20px; font-weight: 640; letter-spacing: -.015em; }
.td-gl .muted { font-size: 13px; }
.td-gl-link { margin-left: auto; }

/* ---------- shared page blocks ---------- */
.td-page, .mk-page { display: flex; flex-direction: column; gap: 18px; }
.td-page .page-head, .mk-page .page-head { margin-bottom: 0; }
.td-card-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.td-card-title .btn, .td-card-title > .muted { margin-left: auto; }
.td-card-title > .muted { font-size: 12.5px; }
.mk-foot { font-size: 12.5px; margin: 12px 0 0; }
.td-cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.mk-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.td-ic { width: 14px; height: 14px; vertical-align: -2px; margin-right: 3px; }

/* ---------- needs you now ---------- */
.td-hero { border-top: 3px solid var(--accent); padding: 18px 18px 8px; }
.td-hero-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.td-hero-head h2 { font-size: 18px; }
.td-hero-head .muted { font-size: 13px; }
.td-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 8px 28px; }
.td-group { margin-bottom: 14px; min-width: 0; }
.td-group-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.td-note { font-size: 12.5px; margin-left: auto; }
.td-rows { list-style: none; margin: 0; padding: 0; }
.td-row { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1px solid var(--line-soft); min-height: 52px; }
.td-row[data-row] { cursor: pointer; }
.td-row[data-row]:hover { background: var(--surface-2); }
.td-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.td-line { gap: 8px; min-width: 0; }
.td-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; align-items: center; }
.td-who { display: block; min-width: 0; }
.td-task { font-weight: 560; }
.td-amount { color: var(--text); }
.td-link { background: none; border: 0; padding: 2px 0; margin: 0; color: inherit; text-align: left; cursor: pointer; min-width: 0; display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.td-link:hover b, .td-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.td-acts { display: flex; gap: 6px; flex: none; }
.td-acts .btn, .td-row .check { min-height: 34px; }
.td-row .check { width: 22px; height: 22px; min-height: 22px; }
.td-more { margin-top: 4px; min-height: 34px; }
.td-ads { display: flex; align-items: center; gap: 10px; padding: 12px 4px 10px; margin-top: 2px; border-top: 1px solid var(--line-soft); text-decoration: none; color: var(--muted); font-weight: 520; }
.td-ads:hover { color: var(--text); }
.td-ads svg { width: 18px; height: 18px; flex: none; }
.td-ads svg:last-child { margin-left: auto; width: 16px; }
.td-clear-body { display: flex; gap: 14px; align-items: flex-start; padding: 6px 0 14px; }
.td-clear-body h3 { font-size: 15px; }
.td-clear-body p { margin: 4px 0 12px; }
.td-clear-ic { width: 28px; height: 28px; color: var(--good); flex: none; }

/* ---------- numbers ---------- */
.td-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.td-kpi { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.td-kpi-label { font-size: 13px; color: var(--muted); font-weight: 520; }
.td-kpi-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.td-kpi-num { font-size: 26px; font-weight: 650; letter-spacing: -.02em; line-height: 1.15; }
.td-kpi-ch { font-size: 12.5px; }

/* ---------- cards with tables and lists ---------- */
.td-table-card { overflow: hidden; }
.td-table-card .card-head { padding-bottom: 12px; flex-wrap: wrap; }
.td-table-card .card-head .hint { margin-left: 0; }
.td-table-card > .mk-foot { padding: 0 16px 14px; }
.td-table { font-size: 13.5px; }
.td-table td { white-space: nowrap; }
.td-barcell { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }

/* ---------- marketing ---------- */
.mk-key { max-width: 260px; }
.mk-key .clip { display: block; }
.mk-pad { padding: 0 16px 16px; margin: 0; }
.mk-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: end; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.mk-form .input, .mk-form .select { min-height: 38px; }
.mk-note { grid-column: span 3; }
.mk-submit .btn { width: 100%; justify-content: center; min-height: 38px; }
.mk-spend-list { list-style: none; margin: 0; padding: 0; }
.mk-spend-list li { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--line-soft); min-height: 44px; }
.mk-sp-day { color: var(--muted); font-size: 13px; }
.mk-sp-what { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mk-sp-amt { font-weight: 600; }
.mk-spend .btn-icon { min-width: 36px; min-height: 36px; justify-content: center; }
.mk-explain { font-size: 13px; margin: -6px 0 12px; }
.mk-q-list { list-style: none; margin: 0; padding: 0; }
.mk-q-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.mk-q-row:last-child { border-bottom: 0; }
.mk-q-acts { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.mk-q-plat { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.mk-q-plat .btn { min-height: 34px; }
.mk-profit { color: var(--text); }

/* ---------- narrow screens ---------- */
@media (max-width: 1100px) {
  .td-cols { grid-template-columns: minmax(0, 1fr); }
  .mk-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .mk-page .page-head .tools { margin-left: 0; width: 100%; }
  .ch-period { justify-content: flex-start; width: 100%; }
  .ch-custom { width: 100%; }
  .ch-custom .input { flex: 1; width: auto; min-width: 0; }
  .td-hero { padding: 14px 12px 4px; }
  .td-glance { flex-direction: column; align-items: stretch; gap: 0; padding: 6px; }
  .td-gl + .td-gl { border-left: 0; border-top: 1px solid var(--line-soft); }
  .td-gl-link { margin: 6px 0 0; justify-content: center; }
  .td-note { margin-left: 0; width: 100%; }
  .td-row { flex-wrap: wrap; }
  .td-acts { width: 100%; }
  .td-acts .btn { flex: 1; justify-content: center; }
  .td-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .td-kpi { padding: 12px; }
  .td-kpi-num { font-size: 22px; }
  .mk-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mk-note { grid-column: 1 / -1; }
  .mk-submit { grid-column: 1 / -1; }
  .mk-q-acts { width: 100%; align-items: stretch; }
  .mk-q-plat { justify-content: flex-start; }
  .ch-hbars li { grid-template-columns: minmax(80px, 42%) 1fr auto; }
}
@media (prefers-reduced-motion: reduce) {
  .td-row[data-row]:hover, .ch-svg g:hover .ch-hit { transition: none; }
}

@media (max-width: 860px) {
  .ch-period { justify-content: flex-start; }
  .ch-period .seg { flex-wrap: wrap; overflow: visible; }
  .ch-custom:not(.on) { display: none; }
}

/* SEO page */
.seo-cols { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.seo-for { margin: 0 0 -4px; font-size: 13px; }
.seo-grain { margin-left: auto; }
.seo-cols .table { table-layout: fixed; width: 100%; }
.seo-cols .mk-key { width: 62%; overflow: hidden; }
.seo-cols .mk-key .clip { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seo-cols td.right { white-space: nowrap; }
