/*
 * Role dashboards (/dashboard, /dashboard/{role}) — the `.kd` design system.
 * Ported from the approved owner prototype (24 Oct 2026). Everything is scoped under
 * .kd so nothing here can reach another backoffice page. Light theme only.
 * Loaded only by resources/views/dashboard/role.blade.php.
 */
.kd {
  --canvas: #f6f7f9;
  --card: #ffffff;
  --line: #e5e7eb;
  --grid: #eef0f3;
  --ink: #0f172a;
  --muted: #5e6d82; /* was #64748b; 4.5:1+ on canvas, neu-bg and navy-tint (8 Nov 2026) */
  --faint: #94a3b8;
  --navy: #034078;
  --navy-weekend: #4d76a1;
  --navy-tint: #eaf0f6;
  --cerulean: #1282a2;
  --pos: #15803d;
  --pos-bg: #ecfdf3;
  --neg: #b91c1c;
  --neg-bg: #fef2f2;
  --neg-line: #fecaca;
  --neu: #475569;
  --neu-bg: #f1f5f9;
  --amber: #b45309;
  --amber-bg: #fffbeb;
  --amber-line: #fde68a;
  --bar-start: #5b82ab;
  --bar-down: #eeb4b4;
  --bar-up: #9dd5b2;
  --seg-cogs: #475569;
  --seg-ads: #1282a2;
  --seg-logi: #a7b4c4;
  --seg-margin: #15803d;
  --ch-shopee: #ee4d2d;
  --ch-shopee2: #f28b6b;
  --ch-tiktok: #111827;
  --ch-kasual: #034078;
  --ch-pos: #0f766e;
  --ch-manual: #64748b;
  --ch-lazada: #1d4ed8;
  --ch-blibli: #2563eb;
  --ch-intl: #f59e0b;
  --ch-kol: #a855f7;
  --ch-other: #94a3b8;
  --header-bg: rgba(255, 255, 255, 0.82);
  --track: #eef1f5;
  --focus: #1282a2;
  --tip-bg: #0f172a;
  --tip-ink: #f8fafc;
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---- Everything below is scoped to .kd so the Blade port cannot leak into other pages ---- */
.kd { font-family: var(--font); color: var(--ink); font-size: 13px; line-height: 1.45; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
.kd *, .kd *::before, .kd *::after { box-sizing: border-box; }
.kd h1, .kd h2, .kd h3, .kd p, .kd ol, .kd ul, .kd dl, .kd dd, .kd figure { margin: 0; }
.kd ol, .kd ul { padding: 0; list-style: none; }
.kd a { color: inherit; }
.kd button { font: inherit; color: inherit; }
.kd :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.kd .sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.kd svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.kd-wrap { max-width: calc(1320px + 2 * 24px); margin-inline: auto; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }

/* Header */
.kd-top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--header-bg); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.kd-top-in { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; padding-block: 14px; flex-wrap: wrap; }
.kd-top-id { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.kd-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.kd-chip-period { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--neu-bg); color: var(--neu); font-size: 12px; font-weight: 500; white-space: nowrap; }
.kd-chip-period svg.i { width: 14px; height: 14px; }
.kd-top-ctl { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.kd-ctl-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.kd-asof { font-size: 12px; color: var(--muted); }
.kd-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--neu-bg); }
.kd-seg button { border: 0; background: transparent; padding: 6px 11px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.kd-seg button[aria-checked="true"] { background: var(--card); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.kd-custom { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.kd-custom input { font: inherit; font-size: 12px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; }
.kd-switch { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 4px 2px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.kd-switch-track { width: 30px; height: 18px; border-radius: 999px; background: var(--line); position: relative; transition: background 0.18s ease; flex: none; }
.kd-switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--card); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25); transition: transform 0.18s ease; }
.kd-switch[aria-checked="true"] .kd-switch-track { background: var(--navy); }
.kd-switch[aria-checked="true"] .kd-switch-track::after { transform: translateX(12px); }
.kd-iconbtn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); cursor: pointer; color: var(--muted); }
.kd-iconbtn:hover { color: var(--ink); }
.kd-iconbtn.is-spin svg { animation: kd-spin 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes kd-spin { to { transform: rotate(360deg); } }

/* Grid */
.kd-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px; padding-block: 20px 48px; }
.kd-grid > * { grid-column: span 12; min-width: 0; }
@media (min-width: 1100px) {
  .kd-grid > .s8 { grid-column: span 8; }
  .kd-grid > .s4 { grid-column: span 4; }
}
@media (min-width: 768px) and (max-width: 1099px) {
  .kd-grid > .t6 { grid-column: span 6; }
}
.kd-eyebrow-row { display: flex; align-items: baseline; gap: 12px; margin-top: 8px; margin-bottom: -10px; }
.kd-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.kd-eyebrow-row::after { content: ""; flex: 1; height: 1px; background: var(--line); align-self: center; }


/* Card anatomy */
.kd-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.kd-card-hd { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.kd-card-hd > div { min-width: 0; }
.kd-card-title { font-size: 15px; font-weight: 600; line-height: 1.3; display: flex; align-items: center; gap: 6px; text-wrap: balance; }
.kd-helper { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kd-action { font-size: 12px; font-weight: 600; color: var(--navy); text-decoration: none; white-space: nowrap; padding-top: 2px; }
.kd-action:hover { text-decoration: underline; text-underline-offset: 2px; }
.kd-card-ft { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; margin-top: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kd-card-ft b { color: var(--ink); font-weight: 600; }
.kd-label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.kd-info { display: inline-grid; place-items: center; width: 18px; height: 18px; border: 0; padding: 0; background: transparent; color: var(--faint); cursor: help; border-radius: 50%; flex: none; }
.kd-info svg.i { width: 14px; height: 14px; }
.kd-info:hover { color: var(--muted); }

/* Deltas */
.kd-dl { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 999px; white-space: nowrap; line-height: 1.5; cursor: default; }
.kd-dl[data-good="up"] { color: var(--pos); background: var(--pos-bg); }
.kd-dl[data-good="down"] { color: var(--neg); background: var(--neg-bg); }
.kd-dl[data-good="flat"] { color: var(--neu); background: var(--neu-bg); }
.kd-dl.lg { font-size: 13px; padding: 3px 9px; }
.kd.no-compare .kd-cmp { display: none !important; }

/* Hero */
.kd-hero-num { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 12px; }
.kd-big { font-size: 36px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; }
.kd-big.m { font-size: 32px; }
.kd-sub { font-size: 13px; color: var(--muted); margin-top: 6px; }
.kd-sub b { color: var(--ink); font-weight: 600; }
.kd-prev { font-size: 12px; color: var(--muted); }
.kd-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 12px; color: var(--muted); }
.kd-legend span { display: inline-flex; align-items: center; gap: 6px; }
.kd-key { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.kd-key.line { width: 16px; height: 2px; border-radius: 2px; }
.kd-legend details { margin-left: auto; }
.kd-chart { min-height: 0; margin: -4px -6px -8px; }
.kd-chart.hero { height: 260px; }
.kd-chart.bridge { height: 320px; }
.kd-chart.spark { height: 72px; margin: 0; }

/* Collapsible daily table */
.kd-more-tbl summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--navy); list-style: none; }
.kd-more-tbl summary::-webkit-details-marker { display: none; }
.kd-tblwrap { overflow-x: auto; max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.kd-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.kd-tbl th { text-align: left; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); white-space: nowrap; }
.kd-tbl td { padding: 7px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.kd-tbl .r { text-align: right; }
.kd-tbl tr:last-child td { border-bottom: 0; }

/* Margin card */
.kd-kv { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.kd-mid { font-size: 22px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; }
.kd-stack { display: flex; height: 14px; gap: 2px; border-radius: 5px; overflow: hidden; }
.kd-stack i { display: block; height: 100%; min-width: 2px; }
.kd-stack-leg { display: grid; gap: 8px; }
.kd-stack-leg li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 52px; align-items: center; gap: 10px; font-size: 13px; }
.kd-stack-leg .v { color: var(--muted); font-size: 12px; text-align: right; }
.kd-stack-leg .p { font-weight: 600; text-align: right; }
.kd-stack-leg li.is-margin { font-weight: 600; }

/* Bridge */
.kd-bridge { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .kd-bridge { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; } }
.kd-btbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.kd-btbl th { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); text-align: right; padding: 0 0 8px 10px; white-space: nowrap; }
.kd-btbl th:first-child { text-align: left; padding-left: 0; }
.kd-btbl td { padding: 7px 0 7px 10px; text-align: right; border-top: 1px solid var(--grid); white-space: nowrap; }
.kd-btbl td:first-child { text-align: left; padding-left: 0; white-space: normal; }
.kd-btbl .nm { display: inline-flex; align-items: center; gap: 8px; }
.kd-btbl tr.sub td { font-weight: 700; border-top: 1px solid var(--line); }
.kd-btbl tr.sub.cm td:first-child { color: var(--pos); }
.kd-btbl .muted { color: var(--muted); }
.kd-btbl .abbr { display: none; }
.kd-sw { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }

/* Share-bar lists */
.kd-rows { display: grid; gap: 14px; }
.kd-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; align-items: baseline; }
.kd-row .nm { font-weight: 600; min-width: 0; display: flex; align-items: baseline; gap: 7px; }
.kd-row .nm > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.kd-row .rk { color: var(--faint); font-weight: 600; width: 16px; flex: none; font-size: 12px; }
.kd-row .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; transform: translateY(-1px); }
.kd-row .val { text-align: right; font-weight: 600; white-space: nowrap; }
.kd-row .val small { font-weight: 500; color: var(--muted); font-size: 12px; margin-left: 6px; }
.kd-row .meta { font-size: 12px; color: var(--muted); grid-column: 1 / -1; margin-top: -2px; }
.kd-row .bar { grid-column: 1 / -1; height: 6px; margin-top: 3px; border-radius: 3px; background: var(--track); overflow: hidden; }
.kd-row .bar i { display: block; height: 100%; border-radius: 3px; min-width: 2px; }
.kd-row .pre { color: var(--faint); font-weight: 500; }
.kd-tag { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); background: var(--neu-bg); padding: 1px 6px; border-radius: 999px; }
.kd-morebtn { border: 0; background: transparent; padding: 0; font-size: 12px; font-weight: 600; color: var(--navy); cursor: pointer; justify-self: start; }

/* Metric blocks (marketing, customers, orders) */
.kd-mets { display: grid; gap: 14px; }
.kd-met { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: baseline; }
.kd-met .k { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 4px; }
.kd-met .v { font-size: 22px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.25; grid-column: 1; }
.kd-met .v.sm { font-size: 17px; }
.kd-met .d { grid-column: 2; grid-row: 1 / span 2; align-self: center; text-align: right; display: grid; gap: 3px; justify-items: end; }
.kd-met .n { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.kd-met .n a { color: var(--navy); font-weight: 600; text-decoration: none; }
.kd-met .n a:hover { text-decoration: underline; text-underline-offset: 2px; }
.kd-met + .kd-met { border-top: 1px solid var(--grid); padding-top: 14px; }
.kd-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; border-top: 1px solid var(--grid); padding-top: 14px; }
.kd-pair .kd-met { border: 0; padding: 0; grid-template-columns: minmax(0, 1fr); }
.kd-pair .kd-met .d { grid-column: 1; grid-row: auto; justify-items: start; align-self: start; margin-top: 2px; }
.kd-slim { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; grid-column: 1 / -1; margin-top: 6px; }
.kd-slim i { display: block; height: 100%; background: var(--navy); border-radius: 3px; }
.kd-spark-cap { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* Events */
.kd-events { position: relative; max-height: 420px; overflow-y: auto; margin-inline: -8px; padding-inline: 8px; }
.kd-ev { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--grid); }
.kd-ev:first-child { border-top: 0; padding-top: 2px; }
.kd-ev-ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; }
.kd-ev-ic[data-s="ok"] { background: var(--pos-bg); color: var(--pos); }
.kd-ev-ic[data-s="x"] { background: var(--neg-bg); color: var(--neg); }
.kd-ev-ic svg.i { width: 15px; height: 15px; }
.kd-ev-who { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.kd-ev-meta { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.kd-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 1px 7px 1px 6px; border: 1px solid var(--line); border-radius: 999px; white-space: nowrap; }
.kd-badge i { width: 6px; height: 6px; border-radius: 50%; display: block; }

/* Other */
.kd-other { display: grid; gap: 14px; }
.kd-grid > .hug { align-self: start; }
.kd-other-b2b { font-size: 13px; color: var(--muted); }
.kd-other-b2b b { color: var(--ink); font-weight: 600; }

/* Tooltip popover + chart tooltips */
.kd-pop { position: fixed; z-index: 50; max-width: min(280px, calc(100vw - 24px)); padding: 8px 10px; border-radius: 8px; background: var(--tip-bg); color: var(--tip-ink); font-size: 12px; line-height: 1.45; pointer-events: none; box-shadow: 0 6px 24px rgba(15, 23, 42, 0.18); }
.kd .apexcharts-tooltip { background: var(--card) !important; color: var(--ink) !important; border: 1px solid var(--line) !important; border-radius: 10px !important; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12) !important; font-family: var(--font) !important; }
.kd .apexcharts-xaxistooltip { display: none !important; }
.kd-tip { padding: 10px 12px; min-width: 190px; font-size: 12px; }
.kd-tip-h { font-weight: 700; margin-bottom: 6px; display: flex; justify-content: space-between; gap: 12px; }
.kd-tip-h span { font-weight: 500; color: var(--muted); }
.kd-tip-r { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; padding: 2px 0; color: var(--muted); }
.kd-tip-r b { color: var(--ink); font-weight: 600; text-align: right; }
.kd-tip-r i { width: 8px; height: 8px; border-radius: 2px; display: block; }
.kd-tip-note { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); color: var(--muted); }

/* Phone */
@media (max-width: 767px) {
  .kd-wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .kd-top, .kd-top-in { display: contents; }
  .kd-top-id { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--header-bg); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); gap: 4px 10px; }
  .kd-title { font-size: 20px; }
  .kd-top-ctl { align-items: stretch; padding-block: 12px 0; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .kd-ctl-row { justify-content: flex-start; gap: 8px 12px; }
  .kd-seg { width: 100%; }
  .kd-seg button { flex: 1; padding-inline: 4px; }
  .kd-asof { order: -1; display: none; }
  .kd-grid { gap: 16px; padding-block: 12px 32px; }
  .kd-eyebrow-row { margin-bottom: -6px; }
  .kd-card { padding: 16px; gap: 14px; }
  .kd-big { font-size: 32px; }
  .kd-big.m { font-size: 28px; }
  .kd-chart.hero { height: 200px; }
  .kd-btbl .full { display: none; }
  .kd-btbl .abbr { display: inline; }
  .kd-btbl { font-size: 12px; }
  .kd-legend details { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .kd *, .kd *::before, .kd *::after { animation: none !important; transition: none !important; }
}

/* ---- Owner variant: additions on top of the shared design system (no existing rule is restyled) ---- */
/* [hidden] must win over the display set by component classes, whatever skeleton hosts the page. */
.kd [hidden] { display: none !important; }
.kd-chip-role { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; background: var(--navy-tint); color: var(--navy); font-size: 12px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; }
.kd-label-i { display: flex; align-items: center; gap: 4px; }
.kd-term { text-decoration: underline dotted var(--faint); text-decoration-thickness: 1px; text-underline-offset: 3px; cursor: help; }

/* Section eyebrow + the one sentence saying what the section answers */
.kd-eyebrow-row { flex-wrap: wrap; row-gap: 4px; scroll-margin-top: 96px; }
.kd-eyebrow-row::after { order: 1; }
.kd-sec-q { order: 2; flex-basis: 100%; font-size: 13px; color: var(--muted); }

/* Today strip: six action tiles */
.kd-today { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.kd-today > li { display: flex; min-width: 0; }
.kd-tt { --tone: var(--neu); flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 14px 14px 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); box-shadow: inset 0 3px 0 var(--tone); text-decoration: none; color: var(--ink); transition: border-color 0.15s ease; }
.kd-tt[data-tone="red"] { --tone: var(--neg); }
.kd-tt[data-tone="amber"] { --tone: var(--amber); }
.kd-tt[data-tone="green"] { --tone: var(--pos); }
a.kd-tt:hover { border-color: var(--tone); }
.kd-tt-sev { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--tone); }
.kd-tt-sev i { width: 8px; height: 8px; border-radius: 50%; background: var(--tone); flex: none; }
.kd-tt-num { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; color: var(--tone); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kd-tt-num small { font-size: 13px; font-weight: 600; letter-spacing: 0; color: var(--muted); margin-left: 4px; }
.kd-tt-num.is-word { font-size: 20px; line-height: 1.6; }
.kd-tt-lbl { font-size: 13px; font-weight: 600; line-height: 1.3; }
.kd-tt-note { font-size: 12px; color: var(--muted); line-height: 1.35; }
.kd-tt-go { margin-top: auto; padding-top: 8px; font-size: 12px; font-weight: 600; color: var(--navy); }
a.kd-tt:hover .kd-tt-go { text-decoration: underline; text-underline-offset: 2px; }

/* Company pulse: one headline number per department */
.kd-pulse-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.kd-card.kd-pulse { padding: 14px 14px 12px; gap: 4px; }
.kd-pulse-hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; }
.kd-pulse-k { font-size: 12px; color: var(--muted); font-weight: 500; line-height: 1.3; }
.kd-pulse-v { font-size: 22px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.25; white-space: nowrap; }
.kd-pulse-v small { font-size: 12px; font-weight: 600; letter-spacing: 0; color: var(--muted); margin-left: 3px; }
.kd-chart.pulse { height: 40px; margin: 4px -2px 0; }
.kd-pulse-cap { font-size: 11px; color: var(--muted); }

/* Cross-department exceptions (reuses the .kd-ev row anatomy) */
.kd-ev-ic[data-s="warn"] { background: var(--amber-bg); color: var(--amber); }
.kd-events.kd-exc { max-height: none; overflow: visible; }
.kd-exc .kd-ev { align-items: start; }
.kd-exc .kd-ev-ic { margin-top: 1px; }
.kd-exc-side { display: grid; justify-items: end; gap: 2px; padding-top: 2px; text-align: right; }
.kd-exc-when { font-size: 12px; color: var(--muted); white-space: nowrap; }
/* The base `.kd a { color: inherit }` out-ranks `.kd-action`; restate the intended navy for action links. */
.kd a.kd-action { color: var(--navy); }
/* Same specificity trap for `.kd button { color: inherit }`; the base rule's `justify-self: start` is inert in a flex card. */
.kd button.kd-morebtn { color: var(--navy); align-self: flex-start; }
/* Same trap for the icon controls: they drew in ink, and the info icon got lighter on hover. Two/three classes beat the
   base reset but still lose to page rules (`.kd-x .x-toast .kd-iconbtn` keeps its tip-ink close button, hover included). */
.kd .kd-iconbtn { color: var(--muted); }
.kd .kd-iconbtn:hover { color: var(--ink); }
.kd .kd-info { color: var(--faint); }
.kd .kd-info:hover { color: var(--muted); }
.kd-exc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 8px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.kd-exc-meta .kd-badge { color: var(--ink); }

.kd-foot { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }

@media (min-width: 768px) and (max-width: 1099px) {
  .kd-today, .kd-pulse-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  /* .kd .kd-today: must out-rank the `.kd ul` margin/padding reset to bleed to the screen edges */
  .kd .kd-today { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding-bottom: 2px;
    margin-left: calc(-1 * max(16px, env(safe-area-inset-left, 0px))); margin-right: calc(-1 * max(16px, env(safe-area-inset-right, 0px)));
    padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
    scroll-padding-left: max(16px, env(safe-area-inset-left, 0px)); }
  .kd .kd-today::-webkit-scrollbar { display: none; }
  .kd-today > li { flex: 0 0 min(62vw, 220px); scroll-snap-align: start; }
  .kd-pulse-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kd-pulse-k { min-height: 2.6em; }
  .kd-sec-q { font-size: 12px; }
}

/* ---- Backoffice host adjustments (new-layout) ---- */
/* The layout already pads the content column and has a fixed navbar, so the page header
   scrolls with the page instead of sticking under the navbar, and the wrap adds no gutter. */
.kd { background: transparent; }
.kd .kd-wrap { max-width: 1320px; padding-left: 0; padding-right: 0; }
.kd .kd-top { position: relative; top: auto; z-index: 1; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; border-bottom: 0; }
.kd .kd-top-in { padding-block: 4px 8px; }
.kd .kd-grid { padding-block: 12px 40px; }
/* Module slots: wrappers the page script fills; they take no box so the card is the grid item. */
.kd .kd-slot { display: contents; }
.kd .kd-grid > .kd-slot > * { grid-column: span 12; min-width: 0; }
@media (min-width: 1100px) {
  .kd .kd-grid > .kd-slot > .s8 { grid-column: span 8; }
  .kd .kd-grid > .kd-slot > .s4 { grid-column: span 4; }
}
@media (min-width: 768px) and (max-width: 1099px) {
  .kd .kd-grid > .kd-slot > .t6 { grid-column: span 6; }
}
.kd .kd-grid > .kd-slot > .hug { align-self: start; }
.kd .kd-period-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 5px 9px; font-size: 12px; font-weight: 600; color: var(--ink); cursor: pointer; white-space: nowrap; }
.kd .kd-switch[hidden] { display: none !important; }
.kd .kd-load-err { font-size: 12px; color: var(--neg); }
.kd .kd-placeholder { align-items: flex-start; }
.kd .kd-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.kd .kd-links a { display: flex; align-items: center; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); text-decoration: none; font-weight: 600; }
.kd .kd-links a:hover { border-color: var(--navy); color: var(--navy); }
.kd .kd-links i { font-size: 20px; color: var(--navy); }
.kd .kd-pulse-none { font-size: 11px; color: var(--faint); margin-top: 4px; }
@media (max-width: 767px) {
  .kd .kd-top-id, .kd .kd-top-ctl { position: static; padding-left: 0; padding-right: 0; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; border-bottom: 0; }
}

/* Compare dropdown (owner / finance / marketing header; dashboard-business.js) */
.kd .kd-cmpdd { position: relative; display: inline-flex; }
.kd .kd-cmpbtn { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 5px 9px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.kd .kd-cmpbtn.is-on { color: var(--ink); }
.kd .kd-cmpbtn .kd-cmplbl { font-weight: 500; color: var(--muted); }
.kd .kd-cmpbtn svg.i { width: 14px; height: 14px; }
.kd .kd-cmpmenu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; min-width: 290px; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12); display: grid; gap: 2px; }
.kd .kd-cmpmenu button { white-space: nowrap; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; width: 100%; border: 0; background: transparent; text-align: left; padding: 8px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--ink); cursor: pointer; }
.kd .kd-cmpmenu button:hover, .kd .kd-cmpmenu button:focus-visible { background: var(--neu-bg); }
.kd .kd-cmpmenu button[aria-checked="true"] { background: var(--navy-tint); color: var(--navy); }
.kd .kd-cmpmenu .kd-cmpwin { font-weight: 500; color: var(--muted); white-space: nowrap; }
@media (max-width: 767px) { .kd .kd-cmpmenu { left: 0; right: auto; } }

/* ---------- Year target card (owner + marketing): YTD bar + 12-month strip ---------- */
.kd .kd-yt-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px 24px; }
.kd .kd-yt-top > div { display: grid; gap: 2px; min-width: 0; }
.kd .kd-yt-top b { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.kd .kd-yt-top .pct b { color: var(--tone, var(--ink)); }
.kd .kd-yt-top span { font-size: 12px; color: var(--muted); }
.kd .kd-yt-bar { position: relative; height: 12px; border-radius: 6px; background: var(--track); margin-block: 2px; }
.kd .kd-yt-bar .act { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: var(--tone, var(--navy)); }
.kd .kd-yt-bar .ytd { position: absolute; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink); }
.kd .kd-yt-leg { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 12px; color: var(--muted); }
.kd .kd-yt-leg > span { display: inline-flex; align-items: center; gap: 6px; }
.kd .kd-yt-leg b { color: var(--ink); font-weight: 600; }
.kd .kd-yt-leg .sw-ytd { width: 2px; height: 12px; background: var(--ink); border-radius: 1px; }
.kd .kd-yt-leg .sw-tgt { width: 10px; height: 10px; border-radius: 3px; background: var(--track); border: 1px solid var(--line); }
.kd .kd-yt-strip { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; align-items: end; }
.kd .kd-yt-m { display: grid; gap: 4px; justify-items: center; font-size: 11px; color: var(--muted); border-radius: 6px; outline-offset: 2px; }
.kd .kd-yt-m.is-current { color: var(--ink); font-weight: 600; }
.kd .kd-yt-m.is-future { opacity: 0.6; }
.kd .kd-yt-cols { width: 100%; height: 72px; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.kd .kd-yt-cols i { display: block; width: 38%; max-width: 18px; min-height: 1px; border-radius: 3px 3px 0 0; }
.kd .kd-yt-cols .t { background: var(--track); border: 1px solid var(--line); border-bottom: 0; }
.kd .kd-yt-cols .a { background: var(--navy); }
.kd .kd-yt-m.is-current .a { background: repeating-linear-gradient(135deg, var(--navy) 0 3px, var(--navy-tint, var(--track)) 3px 5px); }
@media (max-width: 767px) {
  .kd .kd-yt-strip { gap: 3px; }
  .kd .kd-yt-cols { height: 56px; }
  .kd .kd-yt-m { font-size: 10px; }
}
/* Year target: "Edit targets" (owner page only; dialog built by dashboard-owner.js inside #kd-root) */
.kd .kd-yt-edit { border: 0; background: transparent; padding: 2px 0 0; cursor: pointer; color: var(--navy); }
.kd .kd-yt-dlg { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--ink); box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12); }
.kd .kd-yt-dlg::backdrop { background: rgba(15, 23, 42, 0.4); }
.kd .kd-yt-dlg form { display: grid; gap: 12px; }
.kd .kd-yt-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.kd .kd-yt-fields label { display: grid; gap: 4px; margin: 0; font-size: 12px; font-weight: 600; color: var(--muted); }
.kd .kd-yt-in { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); padding: 0 8px; }
.kd .kd-yt-in:focus-within { border-color: var(--navy); }
.kd .kd-yt-in i { font-style: normal; font-weight: 500; color: var(--faint); }
.kd .kd-yt-in input { flex: 1; min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); padding: 7px 0; text-align: right; }
.kd .kd-yt-in:has(input.is-bad) { border-color: var(--neg); }
.kd .kd-yt-sum { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 12px; color: var(--muted); }
.kd .kd-yt-sum b { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.kd .kd-yt-sum small { margin-left: auto; font-size: 12px; }
.kd .kd-yt-err { font-size: 12px; font-weight: 600; color: var(--neg); }
.kd .kd-yt-acts { display: flex; justify-content: flex-end; gap: 8px; }
.kd .kd-yt-btn { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 7px 14px; font-size: 12px; font-weight: 600; color: var(--ink); cursor: pointer; }
.kd .kd-yt-btn.is-primary { border-color: var(--navy); background: var(--navy); color: #fff; }
.kd .kd-yt-btn:disabled { opacity: 0.55; cursor: default; }
@media (max-width: 479px) { .kd .kd-yt-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
