/* =====================================================================
   QETC Sales Team Analytics — Apple-inspired light theme
   Design principles: SF Pro type, soft neutrals, large radii, subtle
   shadows, hairline borders, generous whitespace.
   ===================================================================== */

/* --- Page-level background override (scoped to dashboard pages only) ---
   When the dashboard is present on the page, we paint the <html> and
   <body> backgrounds to match the dashboard, and clip any horizontal
   overflow. This makes the viewport-width escape trick zoom-safe: even
   if sub-pixel rounding leaves a thin gap at non-100% browser zoom, the
   gap is the same color as the dashboard and is invisible to the eye. */
html:has(.qetc-dash),
body:has(.qetc-dash),
html.qetc-has-dashboard,
body.qetc-has-dashboard {
    background: #f5f5f7 !important;
    overflow-x: hidden;
}
body.qetc-has-dashboard { margin: 0; }

.qetc-dash {
    /* Apple semantic-ish palette */
    --qetc-bg:         #f5f5f7;
    --qetc-surface:    #ffffff;
    --qetc-surface-2:  #fbfbfd;
    --qetc-hair:       #e5e5ea;
    --qetc-hair-2:     #d2d2d7;
    --qetc-text:       #1d1d1f;
    --qetc-text-2:     #424245;
    --qetc-muted:      #86868b;
    --qetc-muted-2:    #a1a1a6;

    --qetc-blue:        #007aff;
    --qetc-blue-soft:   rgba(0,122,255,0.10);
    --qetc-green:       #34c759;
    --qetc-green-soft:  rgba(52,199,89,0.12);
    --qetc-red:         #ff3b30;
    --qetc-red-soft:    rgba(255,59,48,0.10);
    --qetc-orange:      #ff9500;
    --qetc-orange-soft: rgba(255,149,0,0.12);
    --qetc-yellow:      #ffcc00;
    --qetc-indigo:      #5856d6;
    --qetc-pink:        #ff2d55;
    --qetc-teal:        #5ac8fa;
    --qetc-purple:      #af52de;

    --qetc-shadow-1: 0 1px 2px rgba(0,0,0,0.04), 0 1px 1px rgba(0,0,0,0.03);
    --qetc-shadow-2: 0 4px 14px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.04);
    color-scheme: light;

    --qetc-r-sm: 10px;
    --qetc-r-md: 14px;
    --qetc-r-lg: 18px;
    --qetc-r-xl: 22px;

    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text",
                 "SF Pro Display", "Helvetica Neue", Inter, system-ui,
                 "Segoe UI", Roboto, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--qetc-text);
    background: var(--qetc-bg);
    /* Break out of any narrow theme container and span the full viewport.
       1. Negative margins pull the element edge-to-edge.
       2. box-shadow + clip-path extend the dashboard's own background a
          few pixels beyond its box on both sides, absorbing any sub-pixel
          rounding gap that otherwise appears at non-100% browser zoom. */
    position: relative;
    width: 100vw;
    max-width: 100vw;
    margin-left:  calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    box-shadow: 0 0 0 8px var(--qetc-bg);
    clip-path: inset(0 -8px);
    border-radius: 0;
    padding: 32px max(24px, calc(50vw - 720px));
    min-height: 100vh;
    letter-spacing: -0.01em;
}
.qetc-dash *,
.qetc-dash *::before,
.qetc-dash *::after { box-sizing: border-box; }

/* Many WP themes force lowercase on headings via text-transform, which makes
   "Zoom Module" render as "zoom module" and "GSM Calls" as "gsm calls". Lock
   casing to the author's intent (kept `text-transform: uppercase` only where
   we explicitly opt in via .qetc-is-uppercase). */
.qetc-dash,
.qetc-dash h1, .qetc-dash h2, .qetc-dash h3, .qetc-dash h4,
.qetc-dash h5, .qetc-dash h6, .qetc-dash span, .qetc-dash button,
.qetc-dash label, .qetc-dash p, .qetc-dash a,
.qetc-dash th, .qetc-dash td, .qetc-dash li { text-transform: none; }
.qetc-leaderboard thead th { text-transform: uppercase; } /* keep column caps */

/* -------- Header — title + scope glued together on the left, controls
   on the right. Becomes sticky (blurred white strip) once the user
   scrolls past the first 60px so "who + when" is always visible. -- */
.qetc-dash__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 20px;
    padding: 12px 14px;
    margin: -4px -14px 18px;
    background: rgba(255,255,255,0.78);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
    border: 1px solid var(--qetc-hair);
    border-radius: var(--qetc-r-lg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    position: sticky;
    top: 8px;
    z-index: 15;
}
.qetc-dash__titleblock {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.qetc-dash__title {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--qetc-text);
    line-height: 1.15;
}
.qetc-dash__subtitle { display: none; }

/* Scope caption — "who + when" sits right under the title so it travels
   with the page identity instead of floating alone. */
.qetc-dash__scope {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--qetc-text-2);
    letter-spacing: -0.005em;
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.qetc-dash__scope-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--qetc-blue);
    box-shadow: 0 0 0 3px var(--qetc-blue-soft);
    flex: none;
}
.qetc-dash__scope-who  { font-weight: 600; color: var(--qetc-text); }
.qetc-dash__scope-sep  { color: var(--qetc-muted-2); }
.qetc-dash__scope-when { color: var(--qetc-muted); font-weight: 500; font-variant-numeric: tabular-nums; }

.qetc-dash__controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.qetc-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.qetc-field__caption {
    font-size: 11px;
    color: var(--qetc-muted);
    font-weight: 500;
    padding-left: 2px;
    pointer-events: none;
}
/* Team select — subtle blue halo + caption colour when a filter is active
   so the user can spot a non-default choice at a glance. */
.qetc-field--filled .qetc-field__caption { color: var(--qetc-blue); }
.qetc-field--filled select {
    border-color: var(--qetc-blue) !important;
    box-shadow: 0 0 0 3px var(--qetc-blue-soft) !important;
    color: var(--qetc-blue);
    font-weight: 600;
}

/* Date range — From → To pills joined by an arrow so they read as one
   control instead of two disconnected boxes. */
.qetc-daterange {
    display: inline-flex;
    align-items: stretch;
    gap: 0;
    background: var(--qetc-surface);
    border: 1px solid var(--qetc-hair);
    border-radius: var(--qetc-r-md);
    padding: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.qetc-daterange:focus-within {
    border-color: var(--qetc-blue);
    box-shadow: 0 0 0 3px var(--qetc-blue-soft);
}
.qetc-daterange .qetc-datepill {
    border: none;
    background: transparent;
    padding: 4px 14px 6px;
    min-width: 128px;
    border-radius: 10px;
    box-shadow: none;
}
.qetc-daterange .qetc-datepill:hover { background: var(--qetc-surface-2); }
.qetc-daterange .qetc-datepill:focus-within {
    background: var(--qetc-blue-soft);
    box-shadow: none;
}
.qetc-daterange__arrow {
    display: inline-flex;
    align-items: center;
    color: var(--qetc-muted-2);
    font-size: 13px;
    padding: 0 2px;
    user-select: none;
}
.qetc-dash__controls label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: var(--qetc-muted);
    font-weight: 500;
}
.qetc-dash__controls input,
.qetc-dash__controls select {
    background: var(--qetc-surface);
    color: var(--qetc-text);
    border: 1px solid var(--qetc-hair);
    border-radius: var(--qetc-r-sm);
    padding: 8px 12px;
    font-size: 14px;
    font-family: inherit;
    min-width: 160px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.qetc-dash__controls input:focus,
.qetc-dash__controls select:focus {
    outline: none;
    border-color: var(--qetc-blue);
    box-shadow: 0 0 0 3px var(--qetc-blue-soft);
}

/* Primary Apple-style pill button — scoped narrowly to the Refresh
   control only. Earlier this selector was `.qetc-dash button`, which
   (thanks to specificity of 0,1,1) overrode every pill class inside
   the dashboard — quick-date pills, employee pills, chart-type
   selector, module bar — and painted them all blue. Scope it to the
   specific ID so other pills keep their own look. */
#qetc-refresh {
    background: var(--qetc-blue);
    color: #fff;
    border: none;
    border-radius: 980px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, transform 0.08s, box-shadow 0.15s;
    letter-spacing: -0.005em;
}
#qetc-refresh:hover    { background: #0a68d9; }
#qetc-refresh:active   { transform: scale(0.98); }
#qetc-refresh:disabled { opacity: 0.4; cursor: not-allowed; }

/* -------- Date pill (click anywhere on the label to open picker) -- */
.qetc-datepill {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    background: var(--qetc-surface);
    border: 1px solid var(--qetc-hair);
    border-radius: var(--qetc-r-sm);
    padding: 6px 14px 8px;
    cursor: pointer;
    min-width: 150px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.qetc-datepill:hover { border-color: var(--qetc-hair-2); }
.qetc-datepill:focus-within {
    border-color: var(--qetc-blue);
    box-shadow: 0 0 0 3px var(--qetc-blue-soft);
}
.qetc-datepill__caption {
    font-size: 11px;
    color: var(--qetc-muted);
    font-weight: 500;
    pointer-events: none;
}
.qetc-datepill input[type="date"] {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    font-size: 14px;
    color: var(--qetc-text);
    font-family: inherit;
    min-width: 0 !important;
    width: 100%;
    cursor: pointer;
    box-shadow: none !important;
    outline: none;
}
/* Hide the native calendar emoji so the whole pill feels like one control */
.qetc-datepill input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}
.qetc-datepill input[type="date"]::-webkit-inner-spin-button,
.qetc-datepill input[type="date"]::-webkit-clear-button { display: none; }

/* -------- Quick date range pills --------------------------------- */
.qetc-quickdates {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
}
.qetc-quickdate {
    background: var(--qetc-surface);
    color: var(--qetc-text-2);
    border: 1px solid var(--qetc-hair);
    border-radius: 980px;
    padding: 6px 14px;
    font-size: 12.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    letter-spacing: -0.005em;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.qetc-quickdate:hover {
    background: var(--qetc-surface-2);
    color: var(--qetc-text);
    border-color: var(--qetc-hair-2);
}
.qetc-quickdate.is-active {
    background: var(--qetc-blue);
    color: #fff;
    border-color: var(--qetc-blue);
    box-shadow: 0 1px 3px rgba(0,122,255,0.35), 0 0 0 3px var(--qetc-blue-soft);
}
.qetc-quickdate.is-active:hover { background: #0a68d9; color: #fff; }

/* Pills wider than the active module's lookback (e.g. Zoom's 30-day cap)
   get visually muted, non-interactive, and show a help cursor so the
   hover-title explains why. Disabling the native button also blocks
   any programmatic click handlers from firing. */
.qetc-quickdate--unavailable,
.qetc-quickdate:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    pointer-events: auto;   /* keep tooltip on hover */
    background: var(--qetc-surface);
    color: var(--qetc-text-2);
    border-color: var(--qetc-hair);
    box-shadow: none;
}
.qetc-quickdate--unavailable:hover,
.qetc-quickdate:disabled:hover {
    background: var(--qetc-surface);
    color: var(--qetc-text-2);
    border-color: var(--qetc-hair);
}
.qetc-quickdates__note {
    margin: -8px 0 18px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--qetc-text-2);
    letter-spacing: -0.005em;
}
.qetc-quickdates__note::before {
    content: "ⓘ ";
    color: var(--qetc-blue);
    font-weight: 600;
    margin-right: 2px;
}

/* -------- Scope bar (sticky "who + when" banner) ----------------- */
.qetc-scopebar {
    position: sticky;
    top: 8px;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    margin-bottom: 18px;
    background: rgba(255,255,255,0.78);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
    border: 1px solid var(--qetc-hair);
    border-radius: 980px;
    font-size: 13px;
    color: var(--qetc-text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.qetc-scopebar__icon {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--qetc-blue);
    box-shadow: 0 0 0 3px var(--qetc-blue-soft);
    flex: none;
}
.qetc-scopebar__who  { font-weight: 600; letter-spacing: -0.01em; }
.qetc-scopebar__sep  { color: var(--qetc-muted-2); }
.qetc-scopebar__when { color: var(--qetc-muted); font-weight: 500; }

/* -------- Module switcher (segmented control) -------------------- */
.qetc-modbar {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    background: var(--qetc-hair);
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.02);
}
.qetc-modbar__btn {
    background: transparent;
    color: var(--qetc-text-2);
    border: none;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.005em;
}
.qetc-modbar__btn::after { content: none; }
.qetc-modbar__btn:hover {
    color: var(--qetc-text);
    background: rgba(255,255,255,0.6);
}
.qetc-modbar__btn.is-active {
    background: var(--qetc-surface);
    color: var(--qetc-text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 0 0 0.5px rgba(0,0,0,0.04);
}
.qetc-modbar__dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--qetc-muted-2);
    transition: background 0.2s;
}
.qetc-modbar__btn--zoom.is-active      .qetc-modbar__dot { background: var(--qetc-blue);   }
.qetc-modbar__btn--dinstar.is-active   .qetc-modbar__dot { background: var(--qetc-green);  }
.qetc-modbar__btn--pipedrive.is-active .qetc-modbar__dot { background: var(--qetc-orange); }

/* -------- Module container --------------------------------------- */
.qetc-module {
    display: none;
    animation: qetcFade 0.25s ease;
}
.qetc-module.is-active { display: block; }
@keyframes qetcFade {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* -------- Module head (title + sync) ----------------------------- */
.qetc-module__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}
.qetc-module__title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--qetc-text);
}
.qetc-module__title .qetc-module__caption {
    color: var(--qetc-muted);
    font-size: 14px;
    font-weight: 400;
}
.qetc-module__actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qetc-module__pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 980px;
    background: var(--qetc-surface-2);
    color: var(--qetc-text);
    border: 1px solid var(--qetc-hair);
}
.qetc-module__pill--zoom {
    background: var(--qetc-blue-soft);
    color: var(--qetc-blue);
    border-color: transparent;
}
.qetc-module__pill--dinstar {
    background: var(--qetc-green-soft);
    color: #1d8a40;
    border-color: transparent;
}
.qetc-module__pill--pipedrive {
    background: var(--qetc-orange-soft);
    color: #b36a00;
    border-color: transparent;
}

/* -------- Sync button (secondary pill) ---------------------------
   Hover used to fade to surface-2 which, on a white page, looked
   like the label was vanishing. Now hover tints it blue so the
   button clearly reads as "clickable" — text stays legible. */
.qetc-sync-btn {
    background: var(--qetc-surface);
    color: var(--qetc-text);
    border: 1px solid var(--qetc-hair-2);
    border-radius: 980px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.qetc-sync-btn:hover {
    background: var(--qetc-blue-soft);
    border-color: var(--qetc-blue);
    color: var(--qetc-blue);
    box-shadow: 0 1px 3px rgba(0,122,255,0.15);
}
.qetc-sync-btn:disabled {
    opacity: 0.6;
    cursor: wait;
    color: var(--qetc-muted);
}
.qetc-sync-btn:disabled:hover {
    background: var(--qetc-surface);
    border-color: var(--qetc-hair-2);
    color: var(--qetc-muted);
    box-shadow: none;
}
/* v1.17.4 — icon variant. Flex-centered icon + label with a small gap,
   slight lift shadow on hover, and an active-spin class for the Sync
   button while a sync is in flight. Applies on top of .qetc-sync-btn. */
.qetc-sync-btn--icon,
.qetc-print-btn--icon {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px 7px 12px;
    line-height: 1;
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
.qetc-sync-btn--icon:hover,
.qetc-print-btn--icon:hover {
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.10);
    transform: translateY(-0.5px);
}
.qetc-sync-btn__icn,
.qetc-print-btn__icn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    color: currentColor;
}
.qetc-sync-btn--icon.is-busy .qetc-sync-btn__icn svg {
    animation: qetcSyncSpin 1.2s linear infinite;
}
@keyframes qetcSyncSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.qetc-sync-status {
    display: none;
    font-size: 12px;
    color: var(--qetc-muted);
    padding: 4px 10px;
    border-radius: 980px;
    background: var(--qetc-surface-2);
    border: 1px solid var(--qetc-hair);
}
.qetc-sync-status:not(:empty) { display: inline-flex; align-items: center; gap: 6px; }
.qetc-sync-status--running { color: var(--qetc-orange); background: var(--qetc-orange-soft); border-color: transparent; }
.qetc-sync-status--ok      { color: #1d8a40;           background: var(--qetc-green-soft);  border-color: transparent; }
.qetc-sync-status--err     { color: var(--qetc-red);    background: var(--qetc-red-soft);    border-color: transparent; }

.qetc-sync-log-wrap {
    margin: 0 0 16px;
    font-size: 12px;
    color: var(--qetc-muted);
    width: 100%;
}
.qetc-sync-log-wrap summary {
    cursor: pointer;
    user-select: none;
    color: var(--qetc-muted);
}
.qetc-sync-log-wrap summary:hover { color: var(--qetc-text); }
.qetc-sync-log {
    margin: 8px 0 0;
    padding: 14px;
    background: var(--qetc-surface);
    border: 1px solid var(--qetc-hair);
    border-radius: var(--qetc-r-md);
    max-height: 240px;
    overflow: auto;
    white-space: pre-wrap;
    font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
    font-size: 11px;
    line-height: 1.55;
    color: var(--qetc-text-2);
}

/* -------- KPI cards ----------------------------------------------- */
.qetc-dash__kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    /* v1.17.12 — every row of cards stretches to the height of its
       tallest sibling, so a card with a progress bar attached doesn't
       leave the others looking dwarfed. `1fr` makes each row size to
       fill, and align-items: stretch ensures cards fill that row. */
    grid-auto-rows: 1fr;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 20px;
}
.qetc-kpi {
    background: var(--qetc-surface);
    border: 1px solid var(--qetc-hair);
    border-radius: var(--qetc-r-lg);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: transform 0.12s ease, box-shadow 0.2s ease;
    box-shadow: var(--qetc-shadow-1);
    /* Pin the value to the top, push the optional progress block to
       the bottom — keeps the KPI label/value aligned across siblings
       even when one card has a progress bar. */
    justify-content: flex-start;
}
.qetc-kpi__progress {
    margin-top: auto !important;
    padding-top: 8px;
    border-top: 1px solid rgba(15, 23, 42, 0.05);
}
.qetc-kpi:hover {
    transform: translateY(-1px);
    box-shadow: var(--qetc-shadow-2);
}
.qetc-kpi__label {
    font-size: 12px;
    color: var(--qetc-muted);
    font-weight: 500;
}
.qetc-kpi__value {
    font-size: 30px;
    font-weight: 600;
    color: var(--qetc-text);
    letter-spacing: -0.025em;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.qetc-module--zoom    .qetc-kpi:first-child .qetc-kpi__value { color: var(--qetc-blue);  }
.qetc-module--dinstar .qetc-kpi:first-child .qetc-kpi__value { color: var(--qetc-green); }

/* =============================================================================
 * v1.17.11 — Admin per-card hide/show eye toggle.
 *
 * Click the eye to hide a KPI card; click again to show. The card stays
 * present (translucent + collapsed look) so the discovery affordance is
 * preserved — admins always know what cards exist. A "Show all hidden
 * cards" pill appears above the grid when any card is hidden.
 * ========================================================================== */
.qetc-kpi-eye {
    position: absolute;
    top: 8px;
    right: 8px;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--qetc-hair, #e5e7eb);
    border-radius: 999px;
    padding: 4px;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--qetc-muted, #64748b);
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
    z-index: 2;
}
.qetc-kpi {
    /* `position: relative` already set in v1.16.0 — keep it so the eye
       absolute-positions correctly. */
}
.qetc-kpi:hover .qetc-kpi-eye,
.qetc-kpi:focus-within .qetc-kpi-eye,
.qetc-kpi.is-card-hidden .qetc-kpi-eye {
    opacity: 1;
}
.qetc-kpi-eye:hover {
    background: #fff;
    color: var(--qetc-text, #0f172a);
    border-color: #cbd5e1;
}
.qetc-kpi-eye:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}
.qetc-kpi.is-card-hidden {
    opacity: 0.42;
    background: repeating-linear-gradient(
        135deg,
        #fafbfc 0,
        #fafbfc 6px,
        #f1f3f5 6px,
        #f1f3f5 12px
    );
}
.qetc-kpi.is-card-hidden .qetc-kpi__value {
    filter: blur(2px);
}
.qetc-kpi.is-card-hidden:hover {
    opacity: 0.75;
}

.qetc-show-hidden {
    appearance: none;
    -webkit-appearance: none;
    margin: 0 0 12px;
    padding: 6px 14px;
    background: #f0f6ff;
    border: 1px solid #c5dcff;
    border-left: 4px solid #2271b1;
    border-radius: 6px;
    color: #1d4ed8;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}
.qetc-show-hidden:hover {
    background: #dbeafe;
}
.qetc-show-hidden::before {
    content: "👁  ";
}

@media print {
    .qetc-kpi-eye,
    .qetc-show-hidden { display: none !important; }
    .qetc-kpi.is-card-hidden { display: none !important; }
}

/* =============================================================================
 * v1.17.7 — KPI target progress bars.
 *
 * Rendered below the value when:
 *   · A single employee is filtered on the header, and
 *   · A daily target is set in Settings → QETC Targets for that
 *     employee + metric combo.
 *
 * Shows "X / Y (Z%)" plus a coloured bar: green if 100%+, amber 60-99%,
 * red below 60%. The hint row under the track explains the math
 * (daily target × days in window).
 * ========================================================================== */
.qetc-kpi__progress {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.qetc-kpi__progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
}
.qetc-kpi__progress-num {
    color: var(--qetc-muted, #64748b);
    font-weight: 600;
}
.qetc-kpi__progress-pct {
    font-weight: 700;
    letter-spacing: 0.01em;
}
.qetc-kpi__progress-track {
    position: relative;
    width: 100%;
    height: 6px;
    background: #eef0f4;
    border-radius: 999px;
    overflow: hidden;
}
.qetc-kpi__progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}
.qetc-kpi__progress.is-hit .qetc-kpi__progress-fill {
    background: linear-gradient(90deg, #16a34a 0%, #22c55e 100%);
}
.qetc-kpi__progress.is-hit .qetc-kpi__progress-pct {
    color: #16a34a;
}
.qetc-kpi__progress.is-mid .qetc-kpi__progress-fill {
    background: linear-gradient(90deg, #d97706 0%, #f59e0b 100%);
}
.qetc-kpi__progress.is-mid .qetc-kpi__progress-pct {
    color: #b45309;
}
.qetc-kpi__progress.is-low .qetc-kpi__progress-fill {
    background: linear-gradient(90deg, #dc2626 0%, #ef4444 100%);
}
.qetc-kpi__progress.is-low .qetc-kpi__progress-pct {
    color: #b91c1c;
}
.qetc-kpi__progress-hint {
    font-size: 10.5px;
    color: var(--qetc-muted, #64748b);
    letter-spacing: 0.01em;
}

/* -------- Call outcomes breakdown (Apple segmented summary) ----- */
.qetc-outcomes {
    background: var(--qetc-surface);
    border: 1px solid var(--qetc-hair);
    border-radius: var(--qetc-r-lg);
    padding: 22px 22px 18px;
    margin-bottom: 20px;
    box-shadow: var(--qetc-shadow-1);
}
.qetc-outcomes__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.qetc-outcomes__title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--qetc-text);
    letter-spacing: -0.01em;
}
.qetc-outcomes__caption {
    font-size: 12px;
    color: var(--qetc-muted);
}
.qetc-outcomes__bar {
    display: flex;
    height: 10px;
    border-radius: 980px;
    overflow: hidden;
    background: var(--qetc-hair);
    margin-bottom: 18px;
}
.qetc-outcomes__seg {
    height: 100%;
    transition: width 0.4s ease;
    min-width: 2px;
}
.qetc-outcomes__seg--answered  { background: var(--qetc-green);  }
.qetc-outcomes__seg--no_answer { background: var(--qetc-orange); }
.qetc-outcomes__seg--missed    { background: var(--qetc-red);    }
.qetc-outcomes__seg--rejected  { background: var(--qetc-pink);   }
.qetc-outcomes__seg--busy      { background: var(--qetc-yellow); }
.qetc-outcomes__seg--abandoned { background: var(--qetc-purple); }
.qetc-outcomes__seg--canceled  { background: var(--qetc-muted-2); }
.qetc-outcomes__seg--failed    { background: var(--qetc-indigo); }
.qetc-outcomes__bar-empty {
    flex: 1;
    text-align: center;
    font-size: 11px;
    color: var(--qetc-muted);
    line-height: 10px;
    background: var(--qetc-hair);
}
.qetc-outcomes__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 6px;
}
.qetc-outcome {
    display: grid;
    grid-template-columns: 10px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--qetc-r-sm);
    transition: background 0.15s;
}
.qetc-outcome:hover { background: var(--qetc-surface-2); }
.qetc-outcome.is-empty { opacity: 0.4; }
.qetc-outcome__dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--qetc-muted-2);
}
.qetc-outcome--answered  .qetc-outcome__dot { background: var(--qetc-green);  }
.qetc-outcome--no_answer .qetc-outcome__dot { background: var(--qetc-orange); }
.qetc-outcome--missed    .qetc-outcome__dot { background: var(--qetc-red);    }
.qetc-outcome--rejected  .qetc-outcome__dot { background: var(--qetc-pink);   }
.qetc-outcome--busy      .qetc-outcome__dot { background: var(--qetc-yellow); }
.qetc-outcome--abandoned .qetc-outcome__dot { background: var(--qetc-purple); }
.qetc-outcome--canceled  .qetc-outcome__dot { background: var(--qetc-muted-2); }
.qetc-outcome--failed    .qetc-outcome__dot { background: var(--qetc-indigo); }
.qetc-outcome__label {
    font-size: 13px;
    color: var(--qetc-text-2);
    font-weight: 500;
}
.qetc-outcome__value {
    font-size: 15px;
    color: var(--qetc-text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

/* -------- Chart card --------------------------------------------- */
.qetc-dash__chart {
    background: var(--qetc-surface);
    border: 1px solid var(--qetc-hair);
    border-radius: var(--qetc-r-lg);
    padding: 22px;
    margin-bottom: 20px;
    height: 320px;
    box-shadow: var(--qetc-shadow-1);
}
.qetc-dash__chart canvas {
    max-width: 100%;
    width: 100% !important;
    height: 100% !important;
}

/* -------- Tables -------------------------------------------------- */
.qetc-dash__table {
    background: var(--qetc-surface);
    border: 1px solid var(--qetc-hair);
    border-radius: var(--qetc-r-lg);
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: var(--qetc-shadow-1);
}
.qetc-dash__table h4 {
    margin: 0 0 14px;
    font-size: 15px;
    font-weight: 600;
    color: var(--qetc-text);
    letter-spacing: -0.01em;
}
.qetc-leaderboard {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.qetc-leaderboard th,
.qetc-leaderboard td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--qetc-hair);
}
.qetc-leaderboard thead th {
    color: var(--qetc-muted);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--qetc-hair-2);
    background: transparent;
}
.qetc-leaderboard tbody tr:last-child td { border-bottom: none; }
.qetc-leaderboard th.num,
.qetc-leaderboard td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.qetc-leaderboard tbody tr { transition: background 0.12s; }
.qetc-leaderboard tbody tr:hover { background: var(--qetc-surface-2); }
.qetc-leaderboard tbody td:first-child { font-weight: 500; color: var(--qetc-text); }
.qetc-empty {
    padding: 36px 12px;
    text-align: center;
    color: var(--qetc-muted);
    font-style: normal;
    font-size: 13px;
}

/* -------- Recent calls table ------------------------------------- */
.qetc-dash__table--calls { margin-top: 20px; }
.qetc-table__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.qetc-table__head h4 { margin: 0; }
.qetc-table__filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.qetc-chip-select {
    background: var(--qetc-surface-2);
    color: var(--qetc-text);
    border: 1px solid var(--qetc-hair);
    border-radius: 980px;
    padding: 6px 14px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.qetc-chip-select:focus {
    outline: none;
    border-color: var(--qetc-blue);
    box-shadow: 0 0 0 3px var(--qetc-blue-soft);
}
.qetc-table__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
}
.qetc-table__count { font-size: 12px; color: var(--qetc-muted); }

.qetc-ghost-btn {
    background: var(--qetc-surface);
    color: var(--qetc-blue);
    border: 1px solid var(--qetc-hair-2);
    border-radius: 980px;
    padding: 7px 18px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.qetc-ghost-btn:hover {
    background: var(--qetc-blue-soft);
    border-color: var(--qetc-blue);
}
.qetc-ghost-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* -------- Badges -------------------------------------------------- */
.qetc-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 980px;
    border: 1px solid transparent;
    white-space: nowrap;
}
.qetc-badge--in      { background: var(--qetc-blue-soft);   color: var(--qetc-blue); }
.qetc-badge--out     { background: var(--qetc-green-soft);  color: #1d8a40; }
.qetc-badge--ok      { background: var(--qetc-green-soft);  color: #1d8a40; }
.qetc-badge--err     { background: var(--qetc-red-soft);    color: var(--qetc-red); }
.qetc-badge--warn    { background: var(--qetc-orange-soft); color: #b36a00; }
.qetc-badge--neutral { background: var(--qetc-surface-2);   color: var(--qetc-muted); border-color: var(--qetc-hair); }

.qetc-num-cell {
    font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
    font-size: 12px;
    color: var(--qetc-text-2);
}
.qetc-calls td { vertical-align: middle; }

/* -------- Footer -------------------------------------------------- */
.qetc-dash__footer {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--qetc-hair);
    font-size: 12px;
    color: var(--qetc-muted);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.qetc-dash-locked {
    padding: 60px 24px;
    text-align: center;
    color: var(--qetc-muted);
    font-size: 15px;
}

/* -------- Employee pill bar — radio-style filter row ------------
   Horizontal pills, scrollable on narrow screens. One click selects
   an employee (or "All"); the hidden <select> stays in sync so the
   rest of the data pipeline doesn't need rewiring. */
.qetc-empbar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 2px 10px;
    margin: -2px -2px 14px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.qetc-empbar::-webkit-scrollbar { height: 4px; }
.qetc-empbar::-webkit-scrollbar-thumb { background: var(--qetc-hair-2); border-radius: 4px; }
.qetc-emppill {
    flex: none;
    background: var(--qetc-surface);
    color: var(--qetc-text-2);
    border: 1px solid var(--qetc-hair);
    border-radius: 980px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    letter-spacing: -0.005em;
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
    scroll-snap-align: start;
    white-space: nowrap;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.qetc-emppill:hover {
    background: var(--qetc-surface-2);
    color: var(--qetc-text);
    border-color: var(--qetc-hair-2);
}
.qetc-emppill.is-active {
    background: var(--qetc-blue);
    color: #fff;
    border-color: var(--qetc-blue);
    box-shadow: 0 1px 3px rgba(0,122,255,0.35), 0 0 0 3px var(--qetc-blue-soft);
}
.qetc-emppill.is-active .qetc-emppill__team { color: rgba(255,255,255,0.8); opacity: 1; }
.qetc-emppill.is-active:hover { background: #0a68d9; color: #fff; }
.qetc-emppill__team {
    font-size: 11px;
    opacity: 0.75;
    font-weight: 400;
    margin-left: 6px;
}

/* -------- KPI info icon + hover tooltip --------------------------
   Small "i" badge in the corner of each card; hovering the card (or
   the icon) reveals a native-feeling callout explaining the metric. */
.qetc-kpi { position: relative; }
.qetc-kpi__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.qetc-kpi__info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--qetc-surface-2);
    color: var(--qetc-muted);
    border: 1px solid var(--qetc-hair);
    font-size: 10px;
    font-weight: 700;
    font-style: italic;
    font-family: "New York", Georgia, serif;
    letter-spacing: 0;
    line-height: 1;
    cursor: help;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.qetc-kpi:hover .qetc-kpi__info {
    background: var(--qetc-blue-soft);
    color: var(--qetc-blue);
    border-color: transparent;
}
.qetc-kpi[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 14px;
    right: 14px;
    background: rgba(29,29,31,0.96);
    color: #f5f5f7;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
    letter-spacing: -0.005em;
    padding: 10px 12px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.12);
    opacity: 0;
    transform: translateY(4px);
    pointer-events: none;
    transition: opacity 0.15s, transform 0.15s;
    white-space: normal;
    z-index: 20;
    max-width: 320px;
}
.qetc-kpi[data-tip]::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 4px);
    left: 22px;
    border: 6px solid transparent;
    border-top-color: rgba(29,29,31,0.96);
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
    z-index: 20;
}
.qetc-kpi[data-tip]:hover::after,
.qetc-kpi[data-tip]:focus-within::after {
    opacity: 1;
    transform: translateY(0);
}
.qetc-kpi[data-tip]:hover::before,
.qetc-kpi[data-tip]:focus-within::before { opacity: 1; }

/* -------- Call Outcomes chart-type selector ---------------------
   Segmented control on the right of the card head. Switches between
   the proportional bar and Chart.js pie/donut/column views. */
.qetc-outcomes__head {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}
.qetc-outcomes__headtext { display: flex; flex-direction: column; gap: 2px; }
.qetc-chartpick {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    background: var(--qetc-hair);
    border-radius: 10px;
}
.qetc-chartpick__btn {
    background: transparent;
    color: var(--qetc-text-2);
    border: none;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    letter-spacing: -0.005em;
}
.qetc-chartpick__btn:hover {
    color: var(--qetc-text);
    background: rgba(255,255,255,0.65);
}
.qetc-chartpick__btn.is-active {
    background: var(--qetc-blue);
    color: #fff;
    box-shadow: 0 1px 3px rgba(0,122,255,0.35);
}
.qetc-chartpick__btn.is-active:hover { background: #0a68d9; color: #fff; }

/* Chart-view switcher — only one of the three outcome visualisations
   is visible at a time. The `.is-active` variant is wired in JS. */
.qetc-outcomes__chart { display: none; }
.qetc-outcomes__chart.is-active { display: block; }
.qetc-outcomes__chart--bar.is-active { display: flex; }
.qetc-outcomes__chart--canvas {
    height: 260px;
    padding: 4px 0 0;
}
.qetc-outcomes__chart--canvas canvas {
    max-width: 100%;
    width: 100% !important;
    height: 100% !important;
}

/* -------- Zoom per-meeting table --------------------------------- */
.qetc-meetings td { vertical-align: middle; }
.qetc-meetings__topic {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}
.qetc-meetings .qetc-badge--rec {
    background: var(--qetc-indigo);
    color: #fff;
}
.qetc-meetings .qetc-badge--norec {
    background: var(--qetc-surface-2);
    color: var(--qetc-muted);
    border-color: var(--qetc-hair);
}

/* ==================================================================
 * Advanced metrics (expandable) — Service Level / Length / Hour / Day
 * ================================================================== */
.qetc-advanced {
    background: var(--qetc-surface-1);
    border: 1px solid var(--qetc-hair);
    border-radius: 16px;
    margin-top: 20px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.qetc-advanced[open] {
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.qetc-advanced__summary {
    cursor: pointer;
    list-style: none;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    user-select: none;
    transition: background .15s ease;
}
.qetc-advanced__summary:hover {
    background: var(--qetc-surface-2);
}
.qetc-advanced__summary::-webkit-details-marker { display: none; }
.qetc-advanced__chev {
    display: inline-block;
    color: var(--qetc-muted);
    font-size: 14px;
    transform: rotate(0deg);
    transition: transform .15s ease;
}
.qetc-advanced[open] .qetc-advanced__chev { transform: rotate(90deg); }
.qetc-advanced__title {
    font-size: 16px;
    font-weight: 600;
    color: var(--qetc-text);
}
.qetc-advanced__hint {
    color: var(--qetc-muted);
    font-size: 12px;
    margin-left: auto;
}
.qetc-advanced__body {
    padding: 12px 20px 20px;
    border-top: 1px solid var(--qetc-hair);
}

/* ---- Headline strip -------------------------------------------- */
.qetc-adv-head {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin: 6px 0 18px;
}
.qetc-adv-stat {
    background: var(--qetc-surface-2);
    border: 1px solid var(--qetc-hair);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
}
.qetc-adv-stat__label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--qetc-muted);
}
.qetc-adv-stat__value {
    font-size: 20px;
    font-weight: 600;
    color: var(--qetc-text);
    font-variant-numeric: tabular-nums;
}
.qetc-adv-stat--sla .qetc-adv-stat__value { color: #007aff; }

/* ---- Cards grid ------------------------------------------------ */
.qetc-adv-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}
.qetc-adv-card {
    background: var(--qetc-surface-2);
    border: 1px solid var(--qetc-hair);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.qetc-adv-card--wide { grid-column: 1 / -1; }
.qetc-adv-card__head { display: flex; flex-direction: column; gap: 2px; }
.qetc-adv-card__head h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--qetc-text);
}
.qetc-adv-card__hint {
    font-size: 12px;
    color: var(--qetc-muted);
}
.qetc-adv-card__chart {
    position: relative;
    width: 100%;
    min-height: 180px;
}
.qetc-adv-card--hour .qetc-adv-card__chart,
.qetc-adv-card--len  .qetc-adv-card__chart { min-height: 220px; }

/* ---- Service Level bars ---------------------------------------- */
.qetc-sla-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.qetc-sla-row {
    display: grid;
    grid-template-columns: 64px 1fr 120px;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}
.qetc-sla-row__label {
    color: var(--qetc-muted);
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.qetc-sla-row__bar {
    background: rgba(0,0,0,0.05);
    border-radius: 999px;
    overflow: hidden;
    height: 10px;
    display: block;
}
.qetc-sla-row__fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #34c759, #007aff);
    border-radius: 999px;
    transition: width .4s ease;
}
.qetc-sla-row__value {
    color: var(--qetc-text);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.qetc-sla-row__count {
    color: var(--qetc-muted);
    font-weight: 400;
}

/* ---- Disconnection legend -------------------------------------- */
.qetc-adv-legend {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.qetc-adv-legend__item {
    display: grid;
    grid-template-columns: 14px 1fr auto;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}
.qetc-adv-legend__dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.qetc-adv-legend__label { color: var(--qetc-text); }
.qetc-adv-legend__value {
    color: var(--qetc-muted);
    font-variant-numeric: tabular-nums;
}

/* -------- Responsive --------------------------------------------- */
@media (max-width: 820px) {
    .qetc-dash { padding: 18px 16px; border-radius: 0; }
    .qetc-dash__title { font-size: 22px; }
    .qetc-kpi__value { font-size: 24px; }
    .qetc-dash__chart { height: 260px; padding: 16px; }
    .qetc-dash__table, .qetc-outcomes { padding: 16px; }
    .qetc-adv-head { grid-template-columns: repeat(2, 1fr); }
    .qetc-adv-grid { grid-template-columns: 1fr; }
    .qetc-adv-card--wide { grid-column: auto; }
}
@media (max-width: 520px) {
    .qetc-modbar { display: flex; width: 100%; }
    .qetc-modbar__btn { flex: 1; justify-content: center; }
    .qetc-dash__kpis { grid-template-columns: repeat(2, 1fr); }
    .qetc-outcomes__grid { grid-template-columns: 1fr 1fr; }
    .qetc-leaderboard th, .qetc-leaderboard td { padding: 10px 6px; font-size: 12px; }
    .qetc-dash__header { flex-direction: column; align-items: stretch; }
    .qetc-dash__controls { justify-content: space-between; }
    .qetc-daterange .qetc-datepill { min-width: 100px; }
    .qetc-kpi[data-tip]::after { left: 8px; right: 8px; }
    .qetc-adv-head { grid-template-columns: 1fr; }
    .qetc-advanced__hint { display: none; }
    .qetc-sla-row { grid-template-columns: 48px 1fr 90px; }
}

/* =============================================================================
 * PipeDrive (CRM Module) — open pipeline by stage, status pills
 * ========================================================================== */

/* Pipeline card — the "Open pipeline by stage" panel. Uses the same chrome
   as .qetc-dash__table so it sits flush with the rest of the module. */
.qetc-pd-pipeline {
    background: var(--qetc-surface);
    border: 0.5px solid var(--qetc-hair);
    border-radius: 14px;
    padding: 18px 22px 22px;
    margin-bottom: 24px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
/* --hero variant: the live pipeline shown directly under the KPIs.
   Bolder headline, larger numbers, thicker bars — signals "this is
   the current state of sales, right now". */
.qetc-pd-pipeline--hero {
    padding: 22px 26px 26px;
    border: 0.5px solid var(--qetc-hair);
    background: linear-gradient(180deg, #fff 0%, #fafafa 100%);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 12px rgba(0,0,0,0.02);
}
.qetc-pd-pipeline--hero .qetc-table__head h4 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.qetc-pd-pipeline--hero .qetc-pd-stage {
    padding: 12px 0;
}
.qetc-pd-pipeline--hero .qetc-pd-stage__label {
    font-size: 14px;
    font-weight: 500;
}
.qetc-pd-pipeline--hero .qetc-pd-stage__bar {
    height: 14px;
}
.qetc-pd-pipeline--hero .qetc-pd-stage__val {
    font-size: 17px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.qetc-pd-pipeline--hero .qetc-pd-stage__meta {
    font-size: 13px;
}
.qetc-pd-pipeline--hero .qetc-pd-pipeline__pname {
    font-size: 13px;
    color: var(--qetc-text);
    letter-spacing: 0.03em;
}
.qetc-pd-pipeline .qetc-table__head {
    margin-bottom: 12px;
}
.qetc-pd-pipeline__caption {
    color: var(--qetc-muted);
    font-weight: 400;
    font-size: 12px;
}

.qetc-pd-pipeline__group {
    margin-top: 14px;
}
.qetc-pd-pipeline__group:first-child {
    margin-top: 0;
}
.qetc-pd-pipeline__pname {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--qetc-muted);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* A single stage row — label | gradient bar | (deals / value) */
.qetc-pd-stage {
    display: grid;
    grid-template-columns: 180px 1fr 160px;
    align-items: center;
    gap: 14px;
    padding: 8px 0;
    border-bottom: 0.5px solid rgba(0,0,0,0.04);
}
.qetc-pd-stage:last-child {
    border-bottom: 0;
}
.qetc-pd-stage__label {
    font-size: 13px;
    font-weight: 500;
    color: var(--qetc-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.qetc-pd-stage__bar {
    position: relative;
    height: 10px;
    background: var(--qetc-surface-2);
    border-radius: 999px;
    overflow: hidden;
}
.qetc-pd-stage__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--qetc-orange) 0%, var(--qetc-blue) 100%);
    border-radius: 999px;
    transition: width 0.25s ease;
}
.qetc-pd-stage__meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    color: var(--qetc-muted);
}
.qetc-pd-stage__val {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--qetc-text);
}

/* Status pill inside the deals table */
.qetc-pd-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}
.qetc-pd-pill__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

/* Deal title — ellipsis for long titles, tooltip shows full text */
.qetc-pd-deal__title {
    display: inline-block;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

@media (max-width: 820px) {
    .qetc-pd-stage { grid-template-columns: 140px 1fr 120px; gap: 10px; }
    .qetc-pd-deal__title { max-width: 220px; }
}
@media (max-width: 520px) {
    .qetc-pd-stage {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 10px 0;
    }
    .qetc-pd-stage__meta { justify-content: flex-start; }
    .qetc-pd-pipeline { padding: 14px; }
}

/* ---------------------------------------------------------------
   KANBAN-HORIZONTAL PIPELINE BY STAGE
   Each stage is a compact column showing today's count, yesterday's
   count, and a delta pill. Columns scroll horizontally on narrow
   viewports so every stage stays visible without stacking vertically.
   --------------------------------------------------------------- */
.qetc-pd-kanban {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 2px 12px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
}
.qetc-pd-kanban::-webkit-scrollbar { height: 8px; }
.qetc-pd-kanban::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.14);
    border-radius: 999px;
}
.qetc-pd-kstage {
    flex: 0 0 168px;
    min-width: 168px;
    background: var(--qetc-surface);
    border: 0.5px solid var(--qetc-hair);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-snap-align: start;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.qetc-pd-kstage:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}
.qetc-pd-kstage__head {
    font-size: 12px;
    font-weight: 600;
    color: var(--qetc-muted);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.qetc-pd-kstage__today {
    font-size: 28px;
    font-weight: 600;
    line-height: 1.05;
    color: var(--qetc-text);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.qetc-pd-kstage__todaylbl {
    font-size: 11px;
    font-weight: 500;
    color: var(--qetc-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
/* v1.15.5 — "Live" label gets a pulsing green dot so it reads as
   a real-time indicator at a glance. Past-snapshot cards override
   this via the --past modifier to keep the date label calm/neutral. */
.qetc-pd-kstage__today:not(.qetc-pd-kstage__today--past) .qetc-pd-kstage__todaylbl {
    color: #15803d;
    position: relative;
    padding-left: 10px;
}
.qetc-pd-kstage__today:not(.qetc-pd-kstage__today--past) .qetc-pd-kstage__todaylbl::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
    transform: translateY(-50%);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
    animation: qetc-pd-livepulse 1.9s ease-out infinite;
}
@keyframes qetc-pd-livepulse {
    0%   { box-shadow: 0 0 0 0   rgba(34, 197, 94, 0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);    }
    100% { box-shadow: 0 0 0 0   rgba(34, 197, 94, 0);    }
}
@media (prefers-reduced-motion: reduce) {
    .qetc-pd-kstage__today:not(.qetc-pd-kstage__today--past) .qetc-pd-kstage__todaylbl::before {
        animation: none;
    }
}
.qetc-pd-kstage__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    font-size: 12px;
}
.qetc-pd-kstage__yest {
    color: var(--qetc-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.qetc-pd-kstage__delta {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
    white-space: nowrap;
}
.qetc-pd-kstage__delta--up {
    background: rgba(52,199,89,0.12);
    color: #1d8b3a;
}
.qetc-pd-kstage__delta--down {
    background: rgba(255,59,48,0.12);
    color: #c8261b;
}
.qetc-pd-kstage__delta--flat {
    background: rgba(0,0,0,0.06);
    color: var(--qetc-muted);
}
.qetc-pd-kstage__val {
    font-size: 12px;
    font-weight: 500;
    color: var(--qetc-muted);
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
    padding-top: 6px;
    border-top: 0.5px solid rgba(0,0,0,0.05);
}
/* Hero variant: bump sizes slightly so the "today" number reads
   from across the room. */
.qetc-pd-pipeline--hero .qetc-pd-kstage {
    flex-basis: 184px;
    min-width: 184px;
    padding: 14px 16px;
}
.qetc-pd-pipeline--hero .qetc-pd-kstage__today {
    font-size: 32px;
}
@media (max-width: 520px) {
    .qetc-pd-kstage { flex-basis: 150px; min-width: 150px; }
}

/* "X touched today" strip — sits below the yesterday/delta row and
   above the optional history panel. Greyed baseline when 0, tinted
   purple + filled pencil when >0 to draw the eye to active stages. */
.qetc-pd-kstage__touched {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 6px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.3;
    border-radius: 980px;
    background: rgba(0,0,0,0.04);
    color: var(--qetc-muted);
    align-self: flex-start;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: help;
}
.qetc-pd-kstage__touched.is-active {
    background: rgba(91,75,255,0.10);
    color: #4a3be0;
}
.qetc-pd-kstage__touchedicn {
    font-size: 11px;
    line-height: 1;
}
.qetc-pd-kstage__touchedn {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.qetc-pd-kstage__touchedlbl {
    font-weight: 500;
    opacity: 0.82;
}
.qetc-pd-kstage__touchedpct {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    opacity: 0.72;
    margin-left: 2px;
}

/* 7-day history list inside a Kanban column. Shown only when the
   user toggles "Show 7-day history" on the card header. */
.qetc-pd-kstage__hist {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 0.5px dashed rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.qetc-pd-kstage__histttl {
    font-size: 10px;
    font-weight: 600;
    color: var(--qetc-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}
.qetc-pd-kstage__histrow {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    line-height: 1.4;
}
/* Column header above the history rows — tiny icons that legend
   the four columns: date | # deals | pencil touches | delta. */
.qetc-pd-kstage__histhdr {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: rgba(0,0,0,0.38);
    font-weight: 600;
    padding-bottom: 2px;
    border-bottom: 0.5px dashed rgba(0,0,0,0.06);
    margin-bottom: 2px;
}
.qetc-pd-kstage__histhdr-deals,
.qetc-pd-kstage__histhdr-touch,
.qetc-pd-kstage__histhdr-delta {
    min-width: 22px;
    text-align: center;
}
.qetc-pd-kstage__histhdr-touch { color: rgba(91,75,255,0.55); }
.qetc-pd-kstage__histhdr-delta { min-width: 44px; }
.qetc-pd-kstage__histdate {
    color: var(--qetc-muted);
    font-variant-numeric: tabular-nums;
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Year / extra qualifier on week + quarter rows — muted so the
   primary label ("Week 17" / "Q2") still reads at a glance. */
.qetc-pd-kstage__histsub {
    font-size: 10px;
    color: rgba(0,0,0,0.42);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}
.qetc-pd-kstage__histn {
    font-weight: 600;
    color: var(--qetc-text);
    font-variant-numeric: tabular-nums;
    min-width: 22px;
    text-align: right;
}
/* Touches indicator — pencil glyph + number, purple so it visually
   separates from the primary deal count. Muted when zero. */
.qetc-pd-kstage__histtch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-weight: 600;
    color: #5b4bff;
    font-variant-numeric: tabular-nums;
    min-width: 22px;
    justify-content: flex-end;
    font-size: 10.5px;
}
.qetc-pd-kstage__histtchicn {
    font-size: 10px;
    opacity: 0.75;
}
.qetc-pd-kstage__histrow:not(.qetc-pd-kstage__histrow--has) .qetc-pd-kstage__histtch {
    color: rgba(0,0,0,0.25);
}
.qetc-pd-kstage__histd {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    min-width: 44px;
    text-align: center;
}
.qetc-pd-kstage__histd--up   { background: rgba(52,199,89,0.12);  color: #1d8b3a; }
.qetc-pd-kstage__histd--down { background: rgba(255,59,48,0.12);  color: #c8261b; }
.qetc-pd-kstage__histd--flat { background: rgba(0,0,0,0.06);      color: var(--qetc-muted); }

/* Touches history rows — rows with any touches get a subtle purple
   tint so the eye jumps to days where this stage was actually
   worked. Zero-touch rows stay muted. */
.qetc-pd-kstage__histrow--has {
    background: rgba(91, 75, 255, 0.05);
    border-radius: 6px;
    padding: 2px 6px;
    margin: 0 -6px;
}
.qetc-pd-kstage__histrow--has .qetc-pd-kstage__histn {
    color: #5b4bff;
}

/* Total-touches-today strip above the Kanban. Sits between the
   card header and the columns — one glance-value counter. */
.qetc-pd-touchstrip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    margin: 8px 0 12px;
    border: 1px solid var(--qetc-hair-2);
    border-radius: 10px;
    background: var(--qetc-surface-2);
    font-size: 13px;
    color: var(--qetc-text);
    cursor: help;
}
.qetc-pd-touchstrip.is-active {
    background: rgba(91, 75, 255, 0.08);
    border-color: rgba(91, 75, 255, 0.35);
}
.qetc-pd-touchstrip__icn {
    font-size: 14px;
    line-height: 1;
    color: #5b4bff;
    opacity: 0.85;
}
.qetc-pd-touchstrip__n {
    font-weight: 700;
    font-size: 18px;
    color: var(--qetc-text);
    font-variant-numeric: tabular-nums;
    min-width: 24px;
    text-align: right;
}
.qetc-pd-touchstrip.is-active .qetc-pd-touchstrip__n {
    color: #5b4bff;
}
.qetc-pd-touchstrip__lbl {
    color: var(--qetc-muted);
    font-weight: 500;
}

/* Kanban card actions strip (right side of the card header) */
.qetc-pd-pipeline__actions {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

/* History granularity pill group: Off | Days | Weeks | Quarters.
   Single rounded capsule with segmented pills inside. Active pill
   uses the same purple accent as other pill selectors (#5b4bff). */
.qetc-pd-hist-pills {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    background: var(--qetc-surface-2);
    border: 1px solid var(--qetc-hair-2);
    border-radius: 980px;
}
.qetc-pd-hist-pill {
    background: transparent;
    color: var(--qetc-text);
    border: none;
    border-radius: 980px;
    padding: 4px 11px;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    line-height: 1.2;
    transition: background 0.15s ease, color 0.15s ease;
}
.qetc-pd-hist-pill:hover {
    background: rgba(0,0,0,0.04);
}
.qetc-pd-hist-pill.is-active {
    background: #5b4bff;
    color: #fff;
}
.qetc-pd-hist-pills.is-loading .qetc-pd-hist-pill {
    opacity: 0.55;
    cursor: progress;
}


/* ---------------------------------------------------------------
   PRINT REPORT BUTTON
   Same visual shape as .qetc-sync-btn; lives next to it in the
   module actions strip so users think of it as "this module's
   export to paper".
   --------------------------------------------------------------- */
.qetc-print-btn {
    background: var(--qetc-surface);
    color: var(--qetc-text);
    border: 1px solid var(--qetc-hair-2);
    border-radius: 980px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.qetc-print-btn:hover {
    background: var(--qetc-blue-soft);
    border-color: var(--qetc-blue);
    color: var(--qetc-blue);
    box-shadow: 0 1px 3px rgba(0,122,255,0.15);
}
.qetc-print-btn:disabled {
    opacity: 0.6;
    cursor: wait;
    color: var(--qetc-muted);
}

/* Hidden on-screen. Only revealed by @media print below. */
.qetc-print-header {
    display: none;
}


/* ===============================================================
   Secondary-action Sync button variant (Backfill Stage History).
   Same pill silhouette as .qetc-sync-btn but tinted so users can
   tell at a glance which button kicks off which workflow.
   =============================================================== */
.qetc-sync-btn--alt {
    background: linear-gradient(180deg, #fff, #f3eefb);
    border-color: #d7c8ef;
    color: #5b2f99;
}
.qetc-sync-btn--alt:hover {
    background: #f3eefb;
    border-color: #b094dd;
    color: #3d1d6e;
    box-shadow: 0 1px 3px rgba(91, 47, 153, 0.15);
}
.qetc-sync-btn--alt:disabled {
    opacity: 0.6;
    cursor: wait;
    color: #5b2f99;
}


/* ===============================================================
   KPI --warn variant — amber tint for SOP-violation counters
   (currently just "Raw called · still Raw"). Subtle enough to
   read as a normal KPI but flags the card as something to action.
   =============================================================== */
.qetc-kpi--warn {
    background: linear-gradient(180deg, #fff9eb 0%, #fff3d6 100%);
    border-color: #f2d493;
}
.qetc-kpi--warn .qetc-kpi__value {
    color: #a6570b;
}
/* Leaderboard numeric cell — warn variant for non-zero violator rows */
.qetc-num--warn {
    color: #a6570b;
    font-weight: 600;
}


/* ===============================================================
   Stagnant-threshold dropdown inside the "Deals stagnant" KPI.
   =============================================================== */
.qetc-kpi__select {
    margin-left: 6px;
    border: 1px solid var(--qetc-line);
    border-radius: 8px;
    background: #fff;
    color: var(--qetc-text);
    font: inherit;
    font-size: 12px;
    padding: 1px 4px;
    cursor: pointer;
}
.qetc-kpi__select:focus {
    outline: 2px solid var(--qetc-blue-soft);
    outline-offset: 1px;
}


/* ===============================================================
   "Moved out of Raw" expandable section.
   Lives inside a .qetc-advanced <details>; the body contains a
   4-up headline strip, a 2-up grid (stages + employees), and a
   backfill-progress line.
   =============================================================== */
.qetc-pd-raw__strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
@media (max-width: 900px) {
    .qetc-pd-raw__strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.qetc-pd-raw__metric {
    background: #fff;
    border: 1px solid var(--qetc-line);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.qetc-pd-raw__label {
    font-size: 12px;
    color: var(--qetc-muted);
    font-weight: 500;
}
.qetc-pd-raw__value {
    font-size: 26px;
    font-weight: 600;
    color: var(--qetc-text);
    letter-spacing: -0.01em;
}
.qetc-pd-raw__sub {
    font-size: 11px;
    color: var(--qetc-muted);
}

.qetc-pd-raw__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 14px;
}
@media (max-width: 1100px) {
    .qetc-pd-raw__grid { grid-template-columns: 1fr; }
}
.qetc-pd-raw__card {
    background: #fff;
    border: 1px solid var(--qetc-line);
    border-radius: 12px;
    padding: 14px 16px;
}
.qetc-pd-raw__card h5 {
    margin: 0 0 10px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--qetc-text);
}
.qetc-pd-raw__stagetbl,
.qetc-pd-raw__emptbl {
    width: 100%;
    font-size: 13px;
}
.qetc-pd-raw__stagetbl th,
.qetc-pd-raw__emptbl th {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid var(--qetc-line);
    font-weight: 500;
    color: var(--qetc-muted);
}
.qetc-pd-raw__stagetbl td,
.qetc-pd-raw__emptbl td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--qetc-line);
}
.qetc-pd-raw__stagetbl td.num,
.qetc-pd-raw__emptbl td.num,
.qetc-pd-raw__stagetbl th.num,
.qetc-pd-raw__emptbl th.num {
    text-align: right;
}
.qetc-pd-raw__emptbl tr:hover td { background: var(--qetc-surface-alt); }

.qetc-pd-raw__progress {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 10px 14px;
    background: var(--qetc-surface-alt);
    border: 1px dashed var(--qetc-line);
    border-radius: 10px;
    font-size: 12px;
    color: var(--qetc-muted);
}
.qetc-pd-raw__progress-label {
    font-weight: 500;
    color: var(--qetc-text);
}


/* ===============================================================
   PRINT STYLESHEET
   When a user clicks "Print Report" (or hits Ctrl/Cmd+P) we strip
   the page of interactive chrome and render just the currently
   active module as a paper-friendly report. Everything else on the
   WP page — site header, footer, sidebars, the dashboard's own
   filters and module switcher — is hidden so the print is clean.
   =============================================================== */
@media print {

    @page {
        size: A4;
        margin: 14mm 12mm;
    }

    html, body {
        background: #fff !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Hide WordPress chrome + any theme-provided wrapping. */
    #wpadminbar, header, footer, aside, nav,
    .site-header, .site-footer, .site-branding, .widget-area,
    .comments-area, .post-navigation, .entry-footer,
    .qetc-header, .qetc-header-strip,
    .qetc-quickdates, .qetc-quickdates__note,
    .qetc-empbar, .qetc-modbar,
    .qetc-sync-btn, .qetc-print-btn,
    .qetc-sync-status, .qetc-sync-log-wrap,
    .qetc-kpi__info, .qetc-info-tip,
    .qetc-module__actions {
        display: none !important;
    }

    /* Only the currently active module is printed. */
    .qetc-module {
        display: none !important;
    }
    .qetc-module.is-active {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    /* Module header becomes the report's section title. */
    .qetc-module__head {
        border: none !important;
        padding: 0 0 4mm 0 !important;
        margin: 0 0 4mm 0 !important;
        border-bottom: 1pt solid #333 !important;
    }
    .qetc-module__title { font-size: 16pt; color: #000 !important; }
    .qetc-module__pill  {
        background: #000 !important;
        color: #fff !important;
        padding: 2pt 8pt;
        border-radius: 3pt;
        font-size: 10pt;
    }
    .qetc-module__caption { color: #555 !important; font-size: 11pt; }

    /* Reveal the print-only header strip with date range + filters. */
    .qetc-print-header {
        display: block !important;
        font-size: 10pt;
        color: #333;
        margin: 0 0 6mm 0;
        padding: 0 0 4mm 0;
        border-bottom: 0.5pt dashed #999;
    }
    .qetc-print-header strong { color: #000; }
    .qetc-print-header__row,
    .qetc-print-header__title {
        display: block;
        margin: 0 0 1mm 0;
    }
    .qetc-print-header__title {
        font-size: 14pt;
        font-weight: 600;
        margin-bottom: 2mm;
    }
    .qetc-print-header__meta {
        display: flex;
        flex-wrap: wrap;
        gap: 8pt 16pt;
        font-size: 9.5pt;
    }

    /* Cards/KPIs/tables shouldn't split across pages. */
    .qetc-kpi, .qetc-card, .qetc-chart-card, .qetc-lb,
    table, tr, thead, .qetc-lb__row, .qetc-lb-row,
    .qetc-pd-pipeline, .qetc-pd-stage,
    .qetc-pd-raw__metric, .qetc-pd-raw__card {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    /* Raw deep-dive: fall back to a single-column stack on paper
       so destination-stage + per-employee tables print fully. */
    .qetc-pd-raw__strip  { grid-template-columns: repeat(2, 1fr) !important; }
    .qetc-pd-raw__grid   { grid-template-columns: 1fr !important; }
    .qetc-pd-raw__value  { font-size: 14pt !important; }
    .qetc-pd-raw__progress { display: none !important; }

    /* Chart.js canvases render at fixed pixel size; force them to
       scale to the printed width. */
    canvas {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Tables: simple black borders, no zebra shading that prints gray. */
    table {
        width: 100% !important;
        border-collapse: collapse !important;
    }
    th, td {
        border: 0.5pt solid #666 !important;
        padding: 3pt 5pt !important;
        font-size: 9.5pt !important;
        background: transparent !important;
        color: #000 !important;
    }
    thead th { background: #eee !important; font-weight: 600; }

    /* Expand <details> so collapsed sections (e.g. Advanced Metrics)
       print their contents. */
    details, details[open] { border: none !important; }
    details > summary {
        font-weight: 600;
        margin: 4mm 0 2mm 0;
        list-style: none;
    }
    details > summary::-webkit-details-marker { display: none; }
    details > * { display: block !important; }

    /* Kill hover/transition artifacts that bleed into print. */
    * {
        animation: none !important;
        transition: none !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    /* Print URLs inline for context (off by default — enable via
       data-attr if we ever want it):
       a[href]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #666; }
    */
}

/* ---- CRM Module — pipeline pill selector (1.10.1) ----------------
   Scoped row inside the CRM module that mirrors the employee pill
   style. First pill is "All pipelines"; injected pills add a small
   count chip so the user can see "(86)" next to Sales Pipeline
   without flipping through each pipeline to find the busy one. */
.qetc-pd-pipesbar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 2px 10px;
    margin: -2px 0 14px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.qetc-pd-pipesbar::-webkit-scrollbar { height: 4px; }
.qetc-pd-pipesbar::-webkit-scrollbar-thumb { background: var(--qetc-hair-2); border-radius: 4px; }

.qetc-pd-pipepill {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--qetc-surface);
    color: var(--qetc-text-2);
    border: 1px solid var(--qetc-hair);
    border-radius: 980px;
    padding: 6px 14px;
    font-size: 12.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    letter-spacing: -0.005em;
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
    scroll-snap-align: start;
    white-space: nowrap;
}
.qetc-pd-pipepill:hover {
    background: var(--qetc-surface-2);
    color: var(--qetc-text);
    border-color: var(--qetc-hair-2);
}
.qetc-pd-pipepill.is-active {
    background: #5b4bff;
    color: #fff;
    border-color: #5b4bff;
    box-shadow: 0 1px 3px rgba(91,75,255,0.35), 0 0 0 3px rgba(91,75,255,0.15);
}
.qetc-pd-pipepill.is-active:hover { background: #4b3ce5; color: #fff; }
.qetc-pd-pipepill__count {
    display: inline-block;
    min-width: 22px;
    padding: 1px 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--qetc-text-2);
    background: var(--qetc-surface-2);
    border-radius: 980px;
    text-align: center;
}
.qetc-pd-pipepill.is-active .qetc-pd-pipepill__count {
    color: #fff;
    background: rgba(255,255,255,0.25);
}

/* =========================================================================
   Past-snapshot banner (v1.14.0)
   When the date filter's "to" is in the past, the Kanban reconstructs the
   pipeline state at that moment. The banner makes it unambiguous that
   what's on screen is not "now" but a historical snapshot. Red tint so it
   stands out against the otherwise neutral Kanban card.
   ========================================================================= */
.qetc-pd-pastbanner {
    display: none;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(255,59,48,0.08);
    border: 1px solid rgba(255,59,48,0.35);
    color: #a8241b;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
}
.qetc-pd-pastbanner.is-visible {
    display: flex;
}
.qetc-pd-pastbanner__icn {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,59,48,0.18);
    color: #c8261b;
    font-size: 14px;
    line-height: 1;
}
.qetc-pd-pastbanner__txt {
    flex: 1 1 auto;
    min-width: 0;
}
.qetc-pd-pastbanner__txt strong {
    color: #8a1d16;
    font-weight: 600;
}

/* Caption variant when viewing a past snapshot — turns the "Live snapshot"
   subtitle red so it matches the banner above. */
.qetc-pd-pipeline__caption--past {
    color: #c8261b;
    font-weight: 500;
}
/* Today-number variant for past snapshots: tint the "as-of date" label
   red + slightly bump its weight so the date, not the word "today",
   becomes the primary cue. */
.qetc-pd-kstage__today--past .qetc-pd-kstage__todaylbl {
    color: #c8261b;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* ---------------------------------------------------------------------------
   v1.15.1 — In/Out flow row on each Kanban column. Compact pill-style
   line of "↓ 3 in · ↑ 1 out" so the user can see both movements along-
   side the delta (which sums them) and the touched-today count.
   --------------------------------------------------------------------------- */
.qetc-pd-kstage__flow {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 6px 0 0;
    padding: 4px 8px;
    border: 1px solid var(--qetc-border, #e6e8eb);
    border-radius: 999px;
    background: #f8fafc;
    font-size: 11.5px;
    color: #374151;
    flex-wrap: wrap;
    justify-content: center;
}
.qetc-pd-kstage__flow.is-quiet { color: #9ca3af; background: #f3f4f6; }
.qetc-pd-kstage__flowpair {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}
.qetc-pd-kstage__flowicn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    font-size: 11px;
    line-height: 1;
    border-radius: 50%;
    font-weight: 700;
}
.qetc-pd-kstage__flowicn--in  { background: #dcfce7; color: #166534; }
.qetc-pd-kstage__flowicn--out { background: #dbeafe; color: #1e40af; }
.qetc-pd-kstage__flown { font-weight: 600; color: #111827; }
.qetc-pd-kstage__flowlbl { color: #6b7280; font-weight: 500; }
.qetc-pd-kstage__flowsep { color: #d1d5db; }
.qetc-pd-kstage__flow.is-quiet .qetc-pd-kstage__flown { color: #9ca3af; font-weight: 500; }
.qetc-pd-kstage__flow.is-quiet .qetc-pd-kstage__flowicn--in,
.qetc-pd-kstage__flow.is-quiet .qetc-pd-kstage__flowicn--out {
    background: #e5e7eb;
    color: #9ca3af;
}

/* ---------------------------------------------------------------------------
   v1.15.0 — Per-stage daily outflow progress bar (gamified target tracker).
   Rendered inside each Kanban column when the filter picks one employee.
   Color states (danger/push/hit) are driven by .is-<state> on the wrapper.
   --------------------------------------------------------------------------- */
.qetc-pd-kstage__progress {
    margin: 8px 0 0;
    padding: 8px 10px;
    border: 1px solid var(--qetc-border, #e6e8eb);
    border-radius: 10px;
    background: #fafbfc;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    transition: background 160ms ease, border-color 160ms ease,
                box-shadow 160ms ease, transform 160ms ease;
}
.qetc-pd-kstage__progress.is-hidden { display: none; }
/* v1.17.13 — Hide the "Set daily target →" placeholder entirely when no
   target is set. Stages without targets just don't render the progress
   block at all, keeping the Kanban clean and pushing admins to the
   QETC Targets admin page when they want to set one. */
.qetc-pd-kstage__progress.is-idle {
    display: none !important;
}

/* v1.17.13 — "Important" red band on stages that have a target.
   Shown as a small pill above the per-stage week strip. Anchored at
   top-left so it lines up regardless of pip count. */
.qetc-pd-kstage.is-has-target {
    position: relative;
}
.qetc-pd-kstage.is-has-target::before {
    content: "Important";
    position: absolute;
    top: -10px;
    left: 12px;
    z-index: 3;
    background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 9px;
    border-radius: 999px;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.35);
    pointer-events: none;
    line-height: 1;
}
@media print {
    .qetc-pd-kstage.is-has-target::before { display: none; }
}
.qetc-pd-kstage__progresshdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.qetc-pd-kstage__progresslbl {
    font-size: 11.5px;
    color: #374151;
    font-weight: 500;
    letter-spacing: 0.01em;
}
.qetc-pd-kstage__progresspct {
    font-size: 11px;
    color: #6b7280;
    font-weight: 600;
    margin-left: 2px;
}
.qetc-pd-kstage__progressedit {
    border: 0;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 13px;
    line-height: 1;
    border-radius: 6px;
    transition: background 140ms ease, color 140ms ease;
}
.qetc-pd-kstage__progressedit:hover { background: #e5e7eb; color: #111827; }
.qetc-pd-kstage__progressedit:disabled { opacity: 0.5; cursor: wait; }

/* v1.15.4 — Edit-targets toggle gating. By default the inline pencil
   and the dashed "Set daily target →" placeholder are hidden so the
   Kanban stays uncluttered for the sales floor. Admins click the
   "Edit targets" pill in the pipeline header to reveal them; the JS
   drops .is-edit-mode onto #qetc-pd-pipeline while it's on. */
.qetc-pd-pipeline .qetc-pd-kstage__progress.is-idle        { display: none; }
.qetc-pd-pipeline .qetc-pd-kstage__progressedit            { display: none; }
.qetc-pd-pipeline.is-edit-mode .qetc-pd-kstage__progress.is-idle { display: flex; }
.qetc-pd-pipeline.is-edit-mode .qetc-pd-kstage__progressedit     { display: inline-flex; }

.qetc-pd-edit-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid var(--qetc-border, #e6e8eb);
    border-radius: 999px;
    background: #fff;
    color: #4b5563;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease,
                color 140ms ease, box-shadow 140ms ease;
}
.qetc-pd-edit-toggle__icn { font-size: 13px; line-height: 1; }
.qetc-pd-edit-toggle:hover {
    background: #f3f4f6;
    border-color: #cbd0d6;
    color: #111827;
}
.qetc-pd-edit-toggle.is-on {
    background: #fff7c8;
    border-color: #e4c94e;
    color: #7a5d00;
    box-shadow: 0 0 0 2px rgba(228, 201, 78, 0.18);
}
.qetc-pd-edit-toggle.is-on:hover {
    background: #fff1a6;
    border-color: #d4b830;
}
.qetc-pd-kstage__progressbar {
    position: relative;
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}
.qetc-pd-kstage__progressfill {
    height: 100%;
    border-radius: 999px;
    transition: width 320ms cubic-bezier(0.2, 0.8, 0.2, 1), background 220ms ease;
}
.qetc-pd-kstage__progressnudge {
    font-size: 11px;
    color: #6b7280;
    letter-spacing: 0.01em;
}

/* State: below 50% — red/rose urgency. */
.qetc-pd-kstage__progress.is-danger { border-color: #fecaca; background: #fef2f2; }
.qetc-pd-kstage__progress.is-danger .qetc-pd-kstage__progressfill { background: #ef4444; }
.qetc-pd-kstage__progress.is-danger .qetc-pd-kstage__progressnudge { color: #b91c1c; font-weight: 500; }

/* State: 50-99% — amber push, "almost there". */
.qetc-pd-kstage__progress.is-push { border-color: #fde68a; background: #fffbeb; }
.qetc-pd-kstage__progress.is-push .qetc-pd-kstage__progressfill { background: #f59e0b; }
.qetc-pd-kstage__progress.is-push .qetc-pd-kstage__progressnudge { color: #b45309; font-weight: 500; }

/* State: ≥100% — golden hit with soft glow + gradient fill. */
.qetc-pd-kstage__progress.is-hit {
    border-color: #f5d67b;
    background: linear-gradient(180deg, #fff8dc 0%, #fdf2c0 100%);
    box-shadow: 0 0 0 1px #f5d67b inset, 0 6px 18px -8px rgba(212, 160, 23, 0.55);
}
.qetc-pd-kstage__progress.is-hit .qetc-pd-kstage__progressfill {
    background: linear-gradient(90deg, #f5b000 0%, #f7cf3f 50%, #f5b000 100%);
    background-size: 200% 100%;
    animation: qetc-pd-hit-shimmer 1600ms linear infinite;
}
.qetc-pd-kstage__progress.is-hit .qetc-pd-kstage__progresslbl { color: #92530c; font-weight: 600; }
.qetc-pd-kstage__progress.is-hit .qetc-pd-kstage__progressnudge { color: #92530c; font-weight: 600; }
@keyframes qetc-pd-hit-shimmer {
    from { background-position:   0% 50%; }
    to   { background-position: 200% 50%; }
}

/* One-shot celebration burst when pct first crosses 100 this session.
   A brief scale pop + radial confetti drawn via ::before / ::after. */
.qetc-pd-kstage__progress.is-celebrating { animation: qetc-pd-hit-pop 620ms cubic-bezier(0.2, 0.8, 0.2, 1) 1; }
.qetc-pd-kstage__progress.is-celebrating::before,
.qetc-pd-kstage__progress.is-celebrating::after {
    content: "";
    position: absolute;
    inset: -10px;
    border-radius: 14px;
    pointer-events: none;
    background-image:
        radial-gradient(circle at 12% 30%, #f5b000 0, #f5b000 2px, transparent 3px),
        radial-gradient(circle at 78% 14%, #d946ef 0, #d946ef 2px, transparent 3px),
        radial-gradient(circle at 42% 92%, #22c55e 0, #22c55e 2px, transparent 3px),
        radial-gradient(circle at 90% 80%, #3b82f6 0, #3b82f6 2px, transparent 3px),
        radial-gradient(circle at 20% 72%, #ef4444 0, #ef4444 2px, transparent 3px),
        radial-gradient(circle at 60% 40%, #14b8a6 0, #14b8a6 2px, transparent 3px);
    animation: qetc-pd-hit-confetti 900ms ease-out 1 forwards;
    opacity: 0;
}
.qetc-pd-kstage__progress.is-celebrating::after { transform: scale(1.4) rotate(8deg); animation-delay: 90ms; }
@keyframes qetc-pd-hit-pop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.035); }
    100% { transform: scale(1); }
}
@keyframes qetc-pd-hit-confetti {
    0%   { opacity: 1; transform: scale(0.7); }
    60%  { opacity: 0.85; }
    100% { opacity: 0;   transform: scale(1.2); }
}

/* ---------------------------------------------------------------------------
   v1.15.0 — Streak strip (Duolingo-style) above the Kanban body.
   Only .is-visible when a single employee is filtered. The wrapper carries a
   state class (.is-hit / .is-frozen / .is-miss / .is-atrisk / .is-idle /
   .is-thawed) that tints the flame + glow.
   --------------------------------------------------------------------------- */
.qetc-pd-streak {
    display: none;
    align-items: center;
    gap: 16px;
    margin: 10px 0 14px;
    padding: 12px 16px;
    border: 1px solid var(--qetc-border, #e6e8eb);
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #fafbfd 100%);
    position: relative;
    flex-wrap: wrap;
}
.qetc-pd-streak.is-visible { display: flex; }
.qetc-pd-streak__hero {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}
.qetc-pd-streak__flame {
    font-size: 28px;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
    transition: transform 200ms ease;
}
.qetc-pd-streak__count {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.02em;
}
.qetc-pd-streak__lbl {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}
.qetc-pd-streak__sub {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: #4b5563;
    flex-wrap: wrap;
}
.qetc-pd-streak__sep { color: #9ca3af; }
.qetc-pd-streak__best { color: #6b7280; font-weight: 500; }
.qetc-pd-streak__heatmap {
    display: flex;
    gap: 4px;
    margin-left: auto;
    align-items: center;
}
.qetc-pd-streak__cell {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    background: #e5e7eb;
    border: 1px solid rgba(0, 0, 0, 0.04);
    display: block;
}
.qetc-pd-streak__cell.is-hit      { background: #f5b000; }
.qetc-pd-streak__cell.is-thawed   { background: #fcd34d; }
.qetc-pd-streak__cell.is-frozen   { background: #93c5fd; }
.qetc-pd-streak__cell.is-atrisk   { background: #fca5a5; }
.qetc-pd-streak__cell.is-miss     { background: #ef4444; }
.qetc-pd-streak__cell.is-idle     { background: #e5e7eb; }

/* Strip-wide state tinting. */
.qetc-pd-streak.is-hit {
    background: linear-gradient(180deg, #fff8dc 0%, #fdf2c0 100%);
    border-color: #f5d67b;
    box-shadow: 0 6px 20px -12px rgba(212, 160, 23, 0.45);
}
.qetc-pd-streak.is-hit .qetc-pd-streak__flame { animation: qetc-pd-flame-float 1800ms ease-in-out infinite; }
.qetc-pd-streak.is-frozen  { background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%); border-color: #bfdbfe; }
.qetc-pd-streak.is-thawed  { background: linear-gradient(180deg, #fefce8 0%, #fef9c3 100%); border-color: #fde68a; }
.qetc-pd-streak.is-atrisk  { background: linear-gradient(180deg, #fff1f2 0%, #ffe4e6 100%); border-color: #fecdd3; }
.qetc-pd-streak.is-miss    { background: linear-gradient(180deg, #fef2f2 0%, #fee2e2 100%); border-color: #fecaca; }
.qetc-pd-streak.is-miss .qetc-pd-streak__count { color: #991b1b; }
.qetc-pd-streak.is-atrisk .qetc-pd-streak__count { color: #9f1239; }
@keyframes qetc-pd-flame-float {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50%      { transform: translateY(-2px) rotate(2deg); }
}

/* =============================================================================
   v1.16.0 — Per-user scoped mode
   When a non-admin WP user is linked to a single employee, the REST layer
   forces that employee_id on every request. We hide the team/employee
   selectors so the UI doesn't imply the user can switch context.
   The date pickers, quickdate pills, and module switcher remain available.
   ============================================================================= */
.qetc-dash--scoped .qetc-empbar,
.qetc-dash--scoped #qetc-empbar {
    display: none !important;
}
.qetc-dash--scoped .qetc-field:has(#qetc-team) {
    display: none !important;
}
/* :has() fallback for older browsers — hide by parent label containing the
   team select. The wrapping <label class="qetc-field"> has no id of its own
   so we rely on a generic sibling-style hide when :has() isn't supported. */
@supports not (selector(:has(*))) {
    .qetc-dash--scoped #qetc-team { display: none; }
    .qetc-dash--scoped .qetc-field { display: none; }
}

/* =============================================================================
   v1.16.1 — Inline login card + "not linked" card + Sign out
   Shown in place of the full dashboard when the visitor isn't logged in
   (or is logged in but their account isn't linked to an employee).
   Matches the dashboard's surface aesthetic so the transition from
   signed-out → signed-in feels like one app, not a WordPress stack.
   ============================================================================= */
.qetc-dash--login {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
}
.qetc-login-card {
    width: 100%;
    max-width: 420px;
    background: var(--qetc-surface, #fff);
    border: 1px solid var(--qetc-hair, #e5e7eb);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    padding: 32px 32px 28px;
    box-sizing: border-box;
}
.qetc-login-card__head { text-align: center; margin-bottom: 22px; }
.qetc-login-card__title {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 700;
    color: var(--qetc-ink, #0f172a);
    letter-spacing: -0.01em;
}
.qetc-login-card__sub {
    margin: 0;
    color: var(--qetc-ink-2, #475569);
    font-size: 14px;
    line-height: 1.5;
}
.qetc-login-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 14px;
}
.qetc-login-form { display: flex; flex-direction: column; gap: 12px; }
.qetc-login-field { display: flex; flex-direction: column; gap: 5px; }
.qetc-login-field span {
    font-size: 12px;
    font-weight: 600;
    color: var(--qetc-ink-2, #475569);
    letter-spacing: 0.01em;
}
.qetc-login-field input {
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid var(--qetc-hair-2, #cbd5e1);
    border-radius: 8px;
    background: var(--qetc-surface, #fff);
    color: var(--qetc-ink, #0f172a);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.qetc-login-field input:focus {
    outline: none;
    border-color: var(--qetc-blue, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.qetc-login-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--qetc-ink-2, #475569);
    user-select: none;
}
.qetc-login-submit {
    display: inline-block;
    text-align: center;
    background: var(--qetc-blue, #2563eb);
    color: #fff;
    border: 0;
    border-radius: 10px;
    padding: 11px 16px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s, transform 0.05s;
    margin-top: 6px;
}
.qetc-login-submit:hover  { background: #1d4ed8; }
.qetc-login-submit:active { transform: translateY(1px); }
.qetc-login-footnote {
    margin: 10px 0 0;
    text-align: center;
    font-size: 12px;
    color: var(--qetc-ink-2, #64748b);
}
.qetc-login-card--notlinked .qetc-login-submit {
    display: block;
    margin-top: 16px;
    background: var(--qetc-ink-2, #475569);
}
.qetc-login-card--notlinked .qetc-login-submit:hover { background: #334155; }

/* Sign-out link in the dashboard header — tiny, unobtrusive; sits after the
   Refresh button. Admins and scoped users both see it. */
.qetc-signout {
    font-size: 12px;
    color: var(--qetc-ink-2, #64748b);
    text-decoration: none;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    margin-left: 4px;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.qetc-signout:hover {
    color: var(--qetc-ink, #0f172a);
    background: var(--qetc-surface-2, #f1f5f9);
    border-color: var(--qetc-hair, #e5e7eb);
}

/* =============================================================================
 * v1.17.0 — Duolingo-style streak redesign
 *
 * Visual language:
 *   • Gamified, friendly, high-contrast. The goal is to make someone
 *     who opens the dashboard for the first time smile.
 *   • Live state = warm orange/red with a subtle glow-float on the
 *     flame. Frozen state = icy blue pallette, flame stops bouncing.
 *   • The weekly pip row is the "board" — 12 cells showing past 7
 *     weeks + this week + next 4 weeks (greyed out as a preview).
 *   • Each pip contains 5 weekday dots that reveal hit/miss at a glance.
 * ========================================================================== */

/* v1.17.3 — NEUTRAL BASE.
   Frozen blue-tint and warm gold-tint on the card body were too loud and
   implied state to users who hadn't earned anything yet. The card body is
   now neutral white regardless of variant. Only the flame + streak count
   carry color. */
.qetc-streak-v2 {
    display: none;
    flex-direction: column;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid var(--qetc-hair, #e5e7eb);
    background: #ffffff;
    margin: 14px 0 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    position: relative;
    overflow: hidden;
}
.qetc-streak-v2.is-visible {
    display: flex;
}
/* Perfect state earns a warm wash — everything else stays neutral. */
.qetc-streak-v2.is-live {
    background: linear-gradient(180deg, #ffffff 0%, #fffaf2 100%);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 4px 14px rgba(255, 127, 32, 0.06);
}
.qetc-streak-v2.is-frozen,
.qetc-streak-v2.is-idle {
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

/* v1.17.5 — CENTERED STACK HERO.
   Previous iterations fought with flex + margin-left:auto and kept leaving a
   "void on the left" when the text was short. Completely abandon horizontal
   anchoring — stack everything vertically, dead-center. Flame on top, big
   count + "WEEK STREAK" label on a single centered row below, chips + info
   centered underneath. Cannot end up floating to one side because there is
   no horizontal competition for space. */
.qetc-streak-v2 .qetc-pd-streak__hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
    padding: 4px 0 2px;
    position: relative;
}
.qetc-streak-v2 .qetc-pd-streak__hero-main {
    display: inline-flex;
    align-items: baseline;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    min-width: 0;
}

/* v1.17.6 — With the flame removed from the hero, push the count a little
   bigger so the card's visual centre of gravity is still obvious. */
.qetc-streak-v6 .qetc-pd-streak__hero {
    padding: 10px 0 4px;
    gap: 8px;
}
.qetc-streak-v6 .qetc-pd-streak__count {
    font-size: 68px;
    line-height: 0.95;
}
.qetc-streak-v6 .qetc-pd-streak__lbl {
    font-size: 14px;
}

/* =============================================================================
 * v1.17.6 — DEFINITIVE fix for the "hero floats right with empty void on
 * left" regression that persisted across v1.17.2 → v1.17.5.
 *
 * Root cause: .qetc-pd-streak is `display: flex; flex-wrap: wrap` (a row
 * flex container). Every child (hero, sub, learn, legend, weeks) is a
 * flex item in that row. Some children grabbed width: 100% (like
 * __learn) while others (the hero) kept their intrinsic content width,
 * so the hero ended up sitting narrow on its own wrapped row — and
 * because later siblings pushed it around it landed on the right with
 * blank space on the left.
 *
 * Fix: for v6, flip the outer card to a COLUMN flex (or block layout
 * effectively). Every direct child then takes the full width by default
 * and internal centering works as expected.
 * ========================================================================== */
.qetc-streak-v6.qetc-pd-streak,
.qetc-streak-v6.qetc-pd-streak.is-visible {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}
.qetc-streak-v6 .qetc-pd-streak__hero,
.qetc-streak-v6 .qetc-pd-streak__sub,
.qetc-streak-v6 .qetc-pd-streak__learn,
.qetc-streak-v6 .qetc-pd-streak__legend,
.qetc-streak-v6 .qetc-pd-streak__weeks {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}
.qetc-streak-v2 .qetc-pd-streak__flameslot {
    width: 96px;
    height: 96px;
    flex: 0 0 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: qetcFlameFloat 3.8s ease-in-out infinite;
    filter: drop-shadow(0 10px 16px rgba(255, 120, 40, 0.22));
    margin: 0 auto;
}
.qetc-streak-v2.is-frozen .qetc-pd-streak__flameslot {
    animation: none;
    filter: grayscale(0.45) drop-shadow(0 4px 8px rgba(120, 100, 90, 0.18));
    opacity: 0.92;
}
.qetc-streak-v2.is-idle .qetc-pd-streak__flameslot {
    animation: none;
    filter: grayscale(1);
    opacity: 0.75;
}
@keyframes qetcFlameFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-4px); }
}

/* (hero-txt was v2/v3; v4 uses hero-main inline + sub on its own row;
   v5 renders hero as a centered vertical stack) */
.qetc-streak-v2 .qetc-pd-streak__count {
    font-size: 56px;
    line-height: 1;
    font-weight: 800;
    color: #d0301a;
    letter-spacing: -1px;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}
.qetc-streak-v2.is-frozen .qetc-pd-streak__count {
    color: #7a6656;
}
.qetc-streak-v2.is-idle .qetc-pd-streak__count {
    color: #94959c;
}
.qetc-streak-v2 .qetc-pd-streak__lbl {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--qetc-ink-2, #334155);
    white-space: nowrap;
}
.qetc-streak-v2 .qetc-pd-streak__sub {
    font-size: 13px;
    color: var(--qetc-ink-3, #64748b);
    line-height: 1.45;
    padding: 0 12px;
    margin: 2px auto 6px;
    text-align: center;
    max-width: 620px;
}
/* v1.17.5 — meta chips sit centered under the count/label, NOT pushed to the
   right. Dropping margin-left:auto + justify-content:flex-end because those
   caused the hero's only content to float right when text was short. */
.qetc-streak-v2 .qetc-pd-streak__meta {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--qetc-ink-3, #64748b);
    flex-wrap: wrap;
    justify-content: center;
    margin: 2px auto 0;
}
.qetc-streak-v2 .qetc-pd-streak__best {
    font-weight: 700;
    color: var(--qetc-ink-2, #334155);
    background: rgba(255, 255, 255, 0.7);
    border-radius: 999px;
    padding: 4px 10px;
    border: 1px solid rgba(15, 23, 42, 0.06);
}
.qetc-streak-v2 .qetc-pd-streak__today {
    font-size: 11.5px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(15, 23, 42, 0.05);
}

/* Weekly timeline row ------------------------------------------------ */
.qetc-streak-v2 .qetc-pd-streak__weeks {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: thin;
    padding: 6px 0 2px;
    scroll-snap-type: x proximity;
}
.qetc-streak-v2 .qetc-pd-streak__wk {
    flex: 0 0 auto;
    min-width: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 6px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.6);
    scroll-snap-align: start;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.qetc-streak-v2 .qetc-pd-streak__wk:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}
/* v1.17.3 — Week pips are NEUTRAL by default. Only a perfect week (hit
   90% of weekday targets) earns color. Current-week gets a soft outline
   ring to mark "you are here" without painting it orange prematurely. */
.qetc-streak-v2 .qetc-pd-streak__wk.is-perfect {
    background: linear-gradient(180deg, #fff5d6 0%, #ffe3a8 100%);
    border-color: #f5b847;
    box-shadow: 0 3px 8px rgba(245, 184, 71, 0.35);
}
.qetc-streak-v2 .qetc-pd-streak__wk.is-broken {
    background: #ffffff;
    border-color: #e3e5ea;
    opacity: 0.85;
}
.qetc-streak-v2 .qetc-pd-streak__wk.is-current {
    background: #ffffff;
    border-color: #cfd4dc;
    box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.14);
}
.qetc-streak-v2 .qetc-pd-streak__wk.is-future {
    background: #fafbfc;
    border-color: #eaeef3;
    opacity: 0.7;
}
.qetc-streak-v2 .qetc-pd-streak__wk.is-idle,
.qetc-streak-v2 .qetc-pd-streak__wk.is-partial {
    background: #ffffff;
    border-color: #ecedf0;
    opacity: 0.7;
}
@keyframes qetcWeekPulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.14); }
    50%      { box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.22); }
}
.qetc-streak-v2 .qetc-pd-streak__wkdots {
    display: grid;
    grid-template-columns: repeat(5, 8px);
    gap: 3px;
}
.qetc-streak-v2 .qetc-pd-streak__wkdot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e5e7eb;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
}
.qetc-streak-v2 .qetc-pd-streak__wkdot.is-hit {
    background: radial-gradient(circle at 35% 25%, #ffe69a 0%, #ff9a2d 70%, #d0301a 100%);
    box-shadow: 0 0 0 1px rgba(208, 48, 26, 0.35),
                0 0 4px rgba(255, 127, 32, 0.6);
}
.qetc-streak-v2 .qetc-pd-streak__wkdot.is-miss {
    background: #ffffff;
    box-shadow: inset 0 0 0 1.5px #cbd5e1;
}
.qetc-streak-v2 .qetc-pd-streak__wkdot.is-idle {
    background: #eef0f4;
}
.qetc-streak-v2 .qetc-pd-streak__wkdot.is-future {
    background: transparent;
    box-shadow: inset 0 0 0 1px #e5e7eb;
}
.qetc-streak-v2 .qetc-pd-streak__wkdot.is-today {
    animation: qetcDotPulse 1.4s ease-in-out infinite;
}
@keyframes qetcDotPulse {
    0%, 100% { transform: scale(1);   }
    50%      { transform: scale(1.35); }
}
.qetc-streak-v2 .qetc-pd-streak__wklbl {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--qetc-ink-3, #64748b);
}
.qetc-streak-v2 .qetc-pd-streak__wk.is-perfect .qetc-pd-streak__wklbl {
    color: #8a5d00;
}
.qetc-streak-v2 .qetc-pd-streak__wk.is-current .qetc-pd-streak__wklbl {
    color: #334155;
    font-weight: 700;
}
.qetc-streak-v2 .qetc-pd-streak__wk.is-future .qetc-pd-streak__wklbl {
    color: #94a3b8;
}

/* =============================================================================
 * v1.17.2 — Year-end weekly map overrides + info panel.
 *
 * The base v2 card still carries hero + flame + meta. We extend it with
 * a scrollable, denser weeks strip (50+ weeks through year-end), a
 * (i) info button, an expandable info panel with flame state gallery,
 * and compact week numbers.
 * ========================================================================== */

.qetc-streak-v3 .qetc-pd-streak__meta {
    align-items: center;
}

.qetc-pd-streak__info-btn {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid rgba(15, 23, 42, 0.2);
    background: rgba(255, 255, 255, 0.7);
    color: #334155;
    font: 700 13px/1 "Georgia", serif;
    font-style: italic;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-left: 6px;
    padding: 0;
}
.qetc-pd-streak__info-btn:hover {
    background: #fff;
    border-color: #334155;
    color: #0f172a;
    transform: translateY(-1px);
}
.qetc-pd-streak__info-btn.is-open {
    background: #0f172a;
    color: #fff;
    border-color: #0f172a;
}

/* v1.17.5 — corner-floated variant of the (i) button so it can live at the
   top-right of the centered-hero card without wedging between chips. */
.qetc-pd-streak__info-btn--corner {
    position: absolute;
    top: 12px;
    right: 14px;
    margin-left: 0;
    z-index: 2;
}

.qetc-pd-streak__info {
    margin-top: 10px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 10px;
    backdrop-filter: blur(6px);
}
.qetc-pd-streak__info[hidden] { display: none; }

.qetc-pd-streak__info-p {
    margin: 0 0 8px;
    font-size: 13px;
    line-height: 1.5;
    color: #334155;
}
.qetc-pd-streak__info-p:last-child { margin-bottom: 0; }
.qetc-pd-streak__info-p strong { color: #0f172a; }

.qetc-pd-streak__flame-gallery {
    display: flex;
    gap: 14px;
    margin-top: 10px;
    padding: 10px;
    background: linear-gradient(135deg, rgba(255, 244, 214, 0.6), rgba(219, 234, 254, 0.45));
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 10px;
    flex-wrap: wrap;
}
.qetc-pd-streak__flame-sample {
    flex: 1 1 130px;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.05);
}
.qetc-pd-streak__flame-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
}
.qetc-pd-streak__flame-thumb svg {
    width: 44px;
    height: 44px;
}
.qetc-pd-streak__flame-caption {
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    color: #334155;
    line-height: 1.35;
}
.qetc-pd-streak__flame-sample.is-frozen { background: #eff6ff; }
.qetc-pd-streak__flame-sample.is-frozen .qetc-pd-streak__flame-caption { color: #1e40af; }
.qetc-pd-streak__flame-sample.is-idle   { background: #f1f5f9; }
.qetc-pd-streak__flame-sample.is-idle .qetc-pd-streak__flame-caption { color: #64748b; }

.qetc-pd-streak__legend {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 11px;
    color: #475569;
}
.qetc-pd-streak__legend-title {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #0f172a;
}
.qetc-pd-streak__legend-dots {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.qetc-pd-streak__legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: 6px;
}
.qetc-pd-streak__legend-dot.is-perfect {
    background: radial-gradient(circle at 35% 25%, #ffe69a 0%, #ff9a2d 70%, #d0301a 100%);
}
.qetc-pd-streak__legend-dot.is-broken {
    /* v1.17.13 — recoloured from brown gradient to a clear red so the
       "broken" state reads as a warning at a glance. Matches the
       Important band on stages with active targets. */
    background: radial-gradient(circle at 35% 25%, #fca5a5 0%, #ef4444 60%, #b91c1c 100%);
    box-shadow: inset 0 0 0 1px rgba(127, 29, 29, 0.4);
}
.qetc-pd-streak__legend-dot.is-current {
    background: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.35);
}
.qetc-pd-streak__legend-dot.is-future {
    background: #e5e7eb;
    box-shadow: inset 0 0 0 1px #cbd5e1;
}
.qetc-pd-streak__legend-lbl {
    margin-right: 4px;
}

/* Year-end weeks strip — horizontally scrollable, denser than the v2
 * 12-week row. Each pip carries a week number on top, the 5 weekday
 * dots in the middle, and a date label at the bottom. */
.qetc-pd-streak__weeks--year {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 2px 10px;
    margin-top: 4px;
    scrollbar-width: thin;
}
.qetc-pd-streak__weeks--year .qetc-pd-streak__wk {
    flex: 0 0 auto;
    min-width: 62px;
    padding: 6px 6px 8px;
    border-radius: 10px;
}
.qetc-pd-streak__weeks--year .qetc-pd-streak__wk.is-current {
    animation: qetcWeekPulse 2.4s ease-in-out infinite;
    border-color: #fb923c;
}
.qetc-pd-streak__wknum {
    display: block;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #94a3b8;
    text-align: center;
    text-transform: uppercase;
    margin-bottom: 3px;
}
.qetc-pd-streak__weeks--year .qetc-pd-streak__wk.is-current .qetc-pd-streak__wknum {
    color: #c2410c;
}
.qetc-pd-streak__weeks--year .qetc-pd-streak__wk.is-perfect .qetc-pd-streak__wknum {
    color: #8a5d00;
}

.qetc-pd-streak__empty {
    padding: 20px;
    text-align: center;
    font-size: 13px;
    color: #94a3b8;
    font-style: italic;
}

/* =============================================================================
 * v1.17.3 — Always-visible rules strip under the hero.
 *
 * Three compact tiles explaining the core of the gamification layer so
 * employees don't need to click (i) to understand how weeks are won.
 * ========================================================================== */
.qetc-pd-streak__rules {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 12px;
    background: linear-gradient(180deg, #fafbfc 0%, #f5f7fa 100%);
    border: 1px solid #eaedf2;
    border-radius: 12px;
    margin: 4px 0 8px;
}
@media (max-width: 720px) {
    .qetc-pd-streak__rules {
        grid-template-columns: 1fr;
    }
}
.qetc-pd-streak__rule {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid #eef0f4;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.qetc-pd-streak__rule-icon {
    font-size: 20px;
    line-height: 1;
    flex: 0 0 auto;
    padding-top: 1px;
}
.qetc-pd-streak__rule-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.qetc-pd-streak__rule-title {
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.qetc-pd-streak__rule-txt {
    font-size: 12.5px;
    line-height: 1.45;
    color: #475569;
}
.qetc-pd-streak__rule-txt strong {
    color: #0f172a;
}

/* =============================================================================
 * v1.17.9 — CRM Target rollup card.
 *
 * Renders between the streak card and the Kanban body when a single
 * employee is filtered and has at least one non-zero target. Shows the
 * employee's total forward moves across the current date window against
 * the window-equivalent target (daily × days / weekly × weeks / monthly
 * × months, summed per-stage). Rollover is implicit — a 5-on-Monday +
 * 15-on-Tuesday day pair reads the same as two 10-days.
 * ========================================================================== */
.qetc-pd-rollup {
    display: none;
    margin: 0 0 14px;
    padding: 14px 18px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #fafbfd 100%);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.qetc-pd-rollup.is-visible { display: block; }
.qetc-pd-rollup__head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.qetc-pd-rollup__icon {
    font-size: 22px;
    line-height: 1;
    flex: 0 0 auto;
}
.qetc-pd-rollup__heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 auto;
    min-width: 0;
}
.qetc-pd-rollup__title {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 0.01em;
}
.qetc-pd-rollup__caption {
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
}
.qetc-pd-rollup__pct {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}
.qetc-pd-rollup__track {
    position: relative;
    width: 100%;
    height: 10px;
    background: #eef0f4;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 6px;
}
.qetc-pd-rollup__fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #dc2626 0%, #ef4444 100%);
    transition: width 0.45s ease, background 0.3s ease;
}
.qetc-pd-rollup.is-mid .qetc-pd-rollup__fill,
.qetc-pd-rollup.is-mid .qetc-pd-rollup__pct {
    color: #b45309;
}
.qetc-pd-rollup.is-mid .qetc-pd-rollup__fill {
    background: linear-gradient(90deg, #d97706 0%, #f59e0b 100%);
}
.qetc-pd-rollup.is-hit .qetc-pd-rollup__fill {
    background: linear-gradient(90deg, #16a34a 0%, #22c55e 100%);
}
.qetc-pd-rollup.is-hit .qetc-pd-rollup__pct {
    color: #16a34a;
}
.qetc-pd-rollup.is-low .qetc-pd-rollup__pct {
    color: #b91c1c;
}
.qetc-pd-rollup__meta {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 12.5px;
    color: #475569;
    font-variant-numeric: tabular-nums;
}
.qetc-pd-rollup__current {
    font-weight: 700;
    color: #0f172a;
}
.qetc-pd-rollup__sep { color: #94a3b8; }
.qetc-pd-rollup__target { color: #334155; }
.qetc-pd-rollup__hint {
    margin-left: auto;
    font-size: 11.5px;
    color: #64748b;
    font-style: italic;
}

/* =============================================================================
 * v1.17.6 — "Learn about streaks" retractable.
 *
 * The previous iteration showed the 3 rule tiles + a separate (i) extended
 * info panel always on the card. The user asked for a cleaner default with
 * the explanation one click away — so both now collapse into a single
 * <details> block labelled "Learn about streaks".
 *
 * Using <details> rather than a manually-toggled div so we inherit:
 *   - native keyboard accessibility
 *   - correct aria-expanded behaviour
 *   - no JS required to open/close
 *
 * The chevron rotates when [open] is toggled. The body uses the existing
 * .qetc-pd-streak__rules grid for the 3 tiles + a small flame gallery +
 * two info paragraphs.
 * ========================================================================== */
.qetc-pd-streak__learn {
    width: 100%;
    margin: 4px 0 10px;
    border: 1px solid #e6e8eb;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    overflow: hidden;
}
.qetc-pd-streak__learn-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    transition: background 0.15s ease;
}
.qetc-pd-streak__learn-btn::-webkit-details-marker { display: none; }
.qetc-pd-streak__learn-btn:hover {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}
.qetc-pd-streak__learn-btn:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: -2px;
}
.qetc-pd-streak__learn-icon {
    font-size: 16px;
    line-height: 1;
    flex: 0 0 auto;
}
.qetc-pd-streak__learn-lbl {
    flex: 1 1 auto;
    letter-spacing: 0.01em;
}
.qetc-pd-streak__learn-chev {
    width: 10px;
    height: 10px;
    border-right: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    flex: 0 0 auto;
    margin-top: -3px;
}
.qetc-pd-streak__learn[open] .qetc-pd-streak__learn-chev {
    transform: rotate(-135deg);
    margin-top: 3px;
}
.qetc-pd-streak__learn-body {
    padding: 12px 14px 14px;
    border-top: 1px solid #eef0f4;
    background: #fafbfc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.qetc-pd-streak__learn-body .qetc-pd-streak__rules {
    margin: 0;
    background: transparent;
    border: 0;
    padding: 0;
}
.qetc-pd-streak__learn-body .qetc-pd-streak__info-p {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.55;
    color: #475569;
}
.qetc-pd-streak__learn-body .qetc-pd-streak__info-p strong {
    color: #0f172a;
    font-weight: 700;
}

/* =============================================================================
 * v1.17.0 — Per-stage weekly pip strip (above each Kanban column).
 * ========================================================================== */
.qetc-pd-kstage__week {
    display: flex;
    gap: 4px;
    justify-content: space-between;
    padding: 4px 4px 2px;
    margin-bottom: 6px;
    border-bottom: 1px dashed rgba(15, 23, 42, 0.06);
}
.qetc-pd-kstage__week.is-hidden { display: none; }
.qetc-pd-kstage__wkpip {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 3px 0;
    min-width: 0;
}
.qetc-pd-kstage__wkdot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e5e7eb;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
    transition: transform 0.2s ease;
}
.qetc-pd-kstage__wkl {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--qetc-ink-3, #94a3b8);
}
.qetc-pd-kstage__wkpip.is-hit .qetc-pd-kstage__wkdot {
    background: radial-gradient(circle at 35% 25%, #ffe69a 0%, #ff9a2d 70%, #d0301a 100%);
    box-shadow: 0 0 0 1px rgba(208, 48, 26, 0.35),
                0 0 4px rgba(255, 127, 32, 0.55);
}
.qetc-pd-kstage__wkpip.is-hit .qetc-pd-kstage__wkl {
    color: #c2410c;
}
/* v1.17.2 — Missed past weekdays render in a DIMMED orange so the color
 * family still says "this was a target day" while being obviously darker
 * and desaturated compared to a hit. Feels like "rust" vs "fire". */
.qetc-pd-kstage__wkpip.is-miss .qetc-pd-kstage__wkdot {
    background: radial-gradient(circle at 35% 25%, #b08060 0%, #6b4a3a 70%, #3a2722 100%);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.35),
                0 0 0 1px rgba(107, 74, 58, 0.35);
    opacity: 0.85;
}
.qetc-pd-kstage__wkpip.is-miss .qetc-pd-kstage__wkl {
    color: #6b4a3a;
    opacity: 0.7;
}
.qetc-pd-kstage__wkpip.is-weekend .qetc-pd-kstage__wkdot {
    background: #f1f5f9;
    opacity: 0.55;
}
.qetc-pd-kstage__wkpip.is-weekend .qetc-pd-kstage__wkl { opacity: 0.45; }
.qetc-pd-kstage__wkpip.is-future .qetc-pd-kstage__wkdot {
    background: transparent;
    box-shadow: inset 0 0 0 1px #e5e7eb;
}
.qetc-pd-kstage__wkpip.is-future .qetc-pd-kstage__wkl { opacity: 0.55; }
.qetc-pd-kstage__wkpip.is-today .qetc-pd-kstage__wkdot {
    animation: qetcDotPulse 1.4s ease-in-out infinite;
}
.qetc-pd-kstage__wkpip.is-today .qetc-pd-kstage__wkl {
    color: #c2410c;
    font-weight: 800;
}
.qetc-pd-kstage__wkpip.is-idle .qetc-pd-kstage__wkdot {
    background: #eef0f4;
}

/* =============================================================================
 * v1.17.0 — Stage card celebration when daily target is hit.
 *
 * Whole column lights up — golden border, warm gradient background,
 * head banner glows, and a subtle ribbon sits above the head. The
 * celebration persists for the rest of the day because the source
 * data (outflow_today / target_daily) stays "hit" once earned.
 * ========================================================================== */
.qetc-pd-kstage.is-target-hit {
    background: linear-gradient(180deg, #fffaed 0%, #fff3d0 100%);
    border-color: #f5b847;
    box-shadow:
        0 0 0 1px rgba(245, 184, 71, 0.45),
        0 8px 22px rgba(245, 184, 71, 0.25);
    position: relative;
    overflow: hidden;
}
.qetc-pd-kstage.is-target-hit::before {
    content: "Target hit";
    position: absolute;
    top: 0;
    right: 0;
    padding: 3px 10px 3px 12px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #7a4a00;
    background: linear-gradient(90deg, #ffe18a 0%, #f5b847 100%);
    border-bottom-left-radius: 10px;
    box-shadow: 0 1px 3px rgba(245, 184, 71, 0.3);
    pointer-events: none;
    z-index: 2;
}
.qetc-pd-kstage.is-target-hit .qetc-pd-kstage__head {
    background: linear-gradient(180deg, #fff6d9 0%, #ffe18a 100%);
    border-bottom-color: #f5b847;
}
.qetc-pd-kstage.is-target-hit .qetc-pd-kstage__today,
.qetc-pd-kstage.is-target-hit .qetc-pd-kstage__todayn {
    color: #b45309;
}
.qetc-pd-kstage.is-target-hit .qetc-pd-kstage__progress {
    background: rgba(255, 237, 191, 0.5);
    border-radius: 10px;
    padding: 6px 8px;
}

/* =============================================================================
 * v1.17.5 — CRM trend chart header + type selector.
 * Mirrors the Call Outcomes head layout so the entire dashboard shares one
 * visual grammar for "this card lets you pick a chart type".
 * ========================================================================== */
.qetc-pd-trend {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.qetc-pd-trend__head {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}
.qetc-pd-trend__headtext {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.qetc-pd-trend__title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--qetc-text, #1d1d1f);
}
.qetc-pd-trend__caption {
    font-size: 12px;
    color: var(--qetc-text-2, #86868b);
}
/* The canvas container inside .qetc-pd-trend keeps the existing chart sizing;
   Chart.js uses the canvas element directly. */
.qetc-pd-trend > canvas {
    max-width: 100%;
}
/* When the selected chart type is Pie or Donut the Chart.js default layout
   wants a squarer aspect ratio — allow the canvas to grow taller. */
.qetc-pd-trend.is-round > canvas {
    height: 320px !important;
    max-height: 320px;
}

/* =============================================================================
 * v1.17.6 — 8-bit pixel cat (reversed direction, intermittent, 4 designs).
 *
 * Key changes from v1.17.5:
 *   · Cat walks right→left now (starts just off-screen right edge, exits
 *     at the left edge). The SVG itself is mirrored with scaleX(-1) so it
 *     faces the direction of travel.
 *   · Stroll animation is no longer infinite — the cat only walks when the
 *     `.is-running` class is on .qetc-cat, and the animation ends itself
 *     after one pass. JS re-adds the class at random intervals.
 *   · 4 designs stored inline; [data-design="…"] on the parent decides
 *     which SVG is visible. Clicking the cat cycles to the next.
 *   · Click → cat briefly sits (is-sitting class freezes legs, shows
 *     "meow!" bubble + sparkle halo), then resumes.
 *   · `pointer-events: auto` on the cat itself (not the runner) so
 *     clicking the cat works but the runner doesn't swallow clicks on
 *     anything else along the bottom edge.
 * ========================================================================== */
.qetc-cat-runner {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100vw;
    height: 70px; /* extra room for bubble above the cat */
    pointer-events: none;
    z-index: 9999;
    overflow: visible;
}
.qetc-cat {
    position: absolute;
    /* Start off-screen on the RIGHT; JS triggers the animation to carry
       the cat across to off-screen left. While idle (between appearances)
       the cat stays parked here, invisible. */
    right: -100px;
    left: auto;
    bottom: 0;
    width: 72px;
    height: 44px;
    transform: translateX(0);
    pointer-events: auto;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    /* Not running by default — JS adds .is-running to start a stroll. */
}
.qetc-cat.is-running {
    animation: qetcCatStroll 22s linear 1 forwards;
}
/* While sitting (user clicked) freeze the stroll + leg swap and show the
   "sit" pose (both leg groups visible overlapping = cat sitting). */
.qetc-cat.is-sitting {
    animation-play-state: paused;
}

/* Focus ring for keyboard users. */
.qetc-cat:focus-visible {
    outline: 2px dashed #f59e0b;
    outline-offset: 3px;
    border-radius: 4px;
}

/* Each design is an SVG; only the one matching [data-design] is shown. */
.qetc-cat__svg {
    position: absolute;
    inset: 0;
    width: 72px;
    height: 44px;
    display: none;
    filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.08));
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    /* v1.17.6 — NO mirror. The SVG is drawn with head on the low-x side
       (left of the sprite) and tail on the high-x side (right of the
       sprite). Since the cat strolls right→left, moving the sprite
       leftward means the head (already on the left edge of the sprite)
       leads the motion — head-first, tail-trailing. A scaleX(-1) would
       flip this and make the cat walk backwards. */
}
.qetc-cat.is-running .qetc-cat__svg {
    animation: qetcCatBob 0.4s steps(2) infinite;
}
.qetc-cat[data-design="black"]  .qetc-cat__svg[data-design="black"],
.qetc-cat[data-design="orange"] .qetc-cat__svg[data-design="orange"],
.qetc-cat[data-design="calico"] .qetc-cat__svg[data-design="calico"],
.qetc-cat[data-design="tuxedo"] .qetc-cat__svg[data-design="tuxedo"] {
    display: block;
}

/* Swap leg frames — only animate when actually running. */
.qetc-cat__legs { opacity: 0; }
.qetc-cat.is-running .qetc-cat__legs--a {
    animation: qetcCatLegsA 0.32s steps(1) infinite;
}
.qetc-cat.is-running .qetc-cat__legs--b {
    animation: qetcCatLegsB 0.32s steps(1) infinite;
}
/* While sitting both leg groups stop animating; show leg-frame A only so
   the cat has a neat seated pose. */
.qetc-cat.is-sitting .qetc-cat__legs--a {
    opacity: 1 !important;
    animation: none !important;
}
.qetc-cat.is-sitting .qetc-cat__legs--b {
    opacity: 0 !important;
    animation: none !important;
}
.qetc-cat.is-sitting .qetc-cat__svg {
    animation: none !important;
}
@keyframes qetcCatLegsA {
    0%, 49.99% { opacity: 1; }
    50%, 100%  { opacity: 0; }
}
@keyframes qetcCatLegsB {
    0%, 49.99% { opacity: 0; }
    50%, 100%  { opacity: 1; }
}
/* Reversed stroll — start at right of screen, end off the left. */
@keyframes qetcCatStroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(calc(-100vw - 140px)); }
}
@keyframes qetcCatBob {
    0%, 49.99% { transform: translateY(0); }
    50%, 100%  { transform: translateY(-1px); }
}

/* ---- Meow bubble (shown briefly after click) ---- */
.qetc-cat__bubble {
    position: absolute;
    left: 50%;
    bottom: 42px;
    transform: translateX(-50%) scale(0.7);
    padding: 4px 8px;
    background: #ffffff;
    border: 1.5px solid #1d1d1f;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    color: #1d1d1f;
    letter-spacing: 0.02em;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.08);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.18s cubic-bezier(.2,1.8,.4,1);
    image-rendering: pixelated;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;
}
.qetc-cat__bubble::after {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0; height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #1d1d1f;
}
.qetc-cat.is-sitting .qetc-cat__bubble {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* ---- Sparkle halo (shown briefly after click) ---- */
.qetc-cat__sparkle {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.qetc-cat__spark {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #fbbf24;
    box-shadow: 0 0 6px #fbbf24;
    opacity: 0;
    border-radius: 50%;
}
.qetc-cat.is-sitting .qetc-cat__spark {
    animation: qetcCatSpark 650ms ease-out 1;
}
.qetc-cat__spark--1 { top: 8px;  left: 10px; animation-delay: 0ms !important; }
.qetc-cat__spark--2 { top: 2px;  left: 36px; animation-delay: 120ms !important; }
.qetc-cat__spark--3 { top: 20px; left: 54px; animation-delay: 220ms !important; }
@keyframes qetcCatSpark {
    0%   { opacity: 0; transform: scale(0.5); }
    50%  { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0; transform: scale(0.6) translateY(-8px); }
}

/* Respect users who prefer no motion — stop the cat so it doesn't distract. */
@media (prefers-reduced-motion: reduce) {
    .qetc-cat,
    .qetc-cat__svg,
    .qetc-cat__legs--a,
    .qetc-cat__legs--b {
        animation: none !important;
    }
    .qetc-cat__legs--a { opacity: 1; }
    .qetc-cat__legs--b { opacity: 0; }
    .qetc-cat { display: none; }
}
/* Print view never has the cat — hide it on paper. */
@media print {
    .qetc-cat-runner { display: none !important; }
}

/* =============================================================================
 * v1.17.17 — Results module (student attribution table).
 *
 * Lives inside the CRM module section as an expandable <details>. Per-month
 * list of won students with a 20/60/20 counsellor split. Auto-rows come from
 * PipeDrive WON deals; the team can also add manual rows.
 * ========================================================================== */
.qetc-pd-results {
    padding: 16px 18px;
    background: #ffffff;
    border-radius: 12px;
}
.qetc-pd-results__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 10px;
}
.qetc-pd-results__monthwrap {
    display: flex;
    align-items: center;
    gap: 6px;
}
.qetc-pd-results__monthlbl {
    font-size: 12px;
    color: var(--qetc-muted, #64748b);
    font-weight: 600;
    letter-spacing: 0.02em;
}
.qetc-pd-results__month {
    border: 1px solid var(--qetc-hair, #e5e7eb);
    border-radius: 8px;
    padding: 5px 8px;
    font-size: 13px;
    background: #ffffff;
    font-variant-numeric: tabular-nums;
}
.qetc-pd-results__actions {
    display: flex;
    gap: 8px;
}
.qetc-pd-results__legend {
    font-size: 12px;
    color: var(--qetc-muted, #64748b);
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
    line-height: 1.5;
}
.qetc-pd-results__legend strong { color: #0f172a; }
.qetc-pd-results__tablewrap {
    overflow-x: auto;
    border: 1px solid var(--qetc-hair, #e5e7eb);
    border-radius: 10px;
    background: #ffffff;
}
.qetc-pd-results__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.qetc-pd-results__table thead {
    background: linear-gradient(180deg, #1e3a5f 0%, #1a3155 100%);
    color: #ffffff;
}
.qetc-pd-results__table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.qetc-pd-results__th-num { text-align: center !important; }
.qetc-pd-results__pts {
    color: rgba(255, 255, 255, 0.65);
    font-weight: 400;
    margin-left: 4px;
}
.qetc-pd-results__table td {
    padding: 6px 10px;
    border-bottom: 1px solid #f1f3f5;
    vertical-align: middle;
}
.qetc-pd-results__table tr:last-child td { border-bottom: 0; }
.qetc-pd-results__table tr.is-manual td:first-child::before {
    content: "M";
    display: inline-block;
    background: #fbbf24;
    color: #78350f;
    font-size: 9px;
    font-weight: 800;
    border-radius: 4px;
    padding: 1px 4px;
    margin-right: 4px;
    letter-spacing: 0.03em;
}
.qetc-pd-results__table input[type="text"] {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 13px;
    transition: border-color 0.12s ease, background 0.12s ease;
}
.qetc-pd-results__table input[type="text"]:hover {
    background: #f8fafc;
    border-color: #e5e7eb;
}
.qetc-pd-results__table input[type="text"]:focus {
    outline: none;
    background: #ffffff;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.15);
}
.qetc-pd-results__table select {
    width: 100%;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 12.5px;
    cursor: pointer;
}
.qetc-pd-results__table select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.15);
}
.qetc-pd-results__total {
    text-align: center;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #16a34a;
}
.qetc-pd-results__total.is-zero { color: #94a3b8; font-weight: 500; }
.qetc-pd-results__total.is-partial { color: #d97706; }
.qetc-pd-results__del {
    background: transparent;
    border: 0;
    color: #94a3b8;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 4px;
}
.qetc-pd-results__del:hover {
    background: #fee2e2;
    color: #b91c1c;
}
.qetc-pd-results__totals {
    margin-top: 18px;
}
.qetc-pd-results__totalhdr {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}
.qetc-pd-results__totaltable {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: #ffffff;
    border: 1px solid var(--qetc-hair, #e5e7eb);
    border-radius: 10px;
    overflow: hidden;
}
.qetc-pd-results__totaltable th {
    background: #f8fafc;
    padding: 8px 12px;
    text-align: left;
    font-size: 12px;
    color: var(--qetc-muted, #64748b);
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
}
.qetc-pd-results__totaltable td {
    padding: 8px 12px;
    border-bottom: 1px solid #f1f3f5;
    font-variant-numeric: tabular-nums;
}
.qetc-pd-results__totaltable tr:last-child td { border-bottom: 0; }
.qetc-pd-results__totaltable td.qetc-pd-results__th-num {
    font-weight: 600;
    color: #0f172a;
}

/* Print: only the Results section, no chrome. */
@media print {
    .qetc-pd-results__actions,
    .qetc-pd-results__del,
    .qetc-pd-results__monthwrap button { display: none !important; }
    .qetc-pd-results__table input[type="text"] { border: 0 !important; background: transparent !important; }
    .qetc-pd-results__table select {
        border: 0 !important;
        background: transparent !important;
        appearance: none;
        -webkit-appearance: none;
    }
}

/* =============================================================================
 * v1.17.21 — Premium gold "Won" card at the right end of each Kanban board.
 *
 * Distinct from .is-target-hit (also gold-ish) by way of:
 *   · deeper gradient (champagne → gold → bronze edge)
 *   · trophy icon header
 *   · animated sparkles
 *   · larger value text
 *   · gold-ringed border
 * The card is always rendered (even at 0 wins) as motivational placeholder.
 * ========================================================================== */
.qetc-pd-kstage--won {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(120% 60% at 0% 0%, rgba(255, 245, 200, 0.85) 0%, rgba(255, 245, 200, 0) 55%),
        linear-gradient(180deg, #fffaeb 0%, #fde9a8 45%, #f6c243 100%);
    border: 1px solid #b8860b;
    box-shadow:
        0 0 0 1px rgba(184, 134, 11, 0.25) inset,
        0 6px 18px -8px rgba(184, 134, 11, 0.45),
        0 2px 4px rgba(212, 175, 55, 0.25);
    border-radius: 14px;
    color: #6b4500;
}
.qetc-pd-kstage--won::before {
    /* subtle shimmer overlay */
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(115deg,
        rgba(255,255,255,0) 35%,
        rgba(255,255,255,0.45) 50%,
        rgba(255,255,255,0) 65%);
    background-size: 250% 250%;
    background-position: 100% 0;
    animation: qetcWonShimmer 5.5s ease-in-out infinite;
    mix-blend-mode: screen;
    border-radius: 14px;
}
@keyframes qetcWonShimmer {
    0%   { background-position: 100% 0; }
    50%  { background-position: -100% 0; }
    100% { background-position: -100% 0; }
}
.qetc-pd-kstage--won__head {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(180deg, #f5b800 0%, #c87f00 100%) !important;
    color: #fff !important;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.18);
    font-weight: 800 !important;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(184, 134, 11, 0.4);
}
.qetc-pd-kstage--won__icn {
    font-size: 18px;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.18));
}
.qetc-pd-kstage--won__title {
    font-size: 13px;
}
.qetc-pd-kstage--won__today {
    text-align: center;
}
.qetc-pd-kstage--won__today .qetc-pd-kstage__todayn {
    font-size: 44px;
    line-height: 1;
    color: #8a5500;
    font-weight: 900;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
    letter-spacing: -0.02em;
    display: block;
}
.qetc-pd-kstage--won__today .qetc-pd-kstage__todaylbl {
    font-size: 10.5px;
    color: rgba(107, 69, 0, 0.8);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.qetc-pd-kstage--won__val {
    text-align: center;
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #6b4500 !important;
    padding: 4px 0;
    border-top: 1px dashed rgba(184, 134, 11, 0.35);
    border-bottom: 1px dashed rgba(184, 134, 11, 0.35);
    margin: 6px 0;
}
.qetc-pd-kstage--won__foot {
    text-align: center;
    font-size: 10.5px;
    color: rgba(107, 69, 0, 0.7);
    font-style: italic;
    padding: 4px 0 2px;
}
.qetc-pd-kstage--won__sparkles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.qetc-pd-kstage--won__sparkle {
    position: absolute;
    font-size: 16px;
    opacity: 0;
    animation: qetcWonSparkle 4.2s ease-in-out infinite;
    filter: drop-shadow(0 1px 2px rgba(184, 134, 11, 0.55));
    color: #f5b800;
}
.qetc-pd-kstage--won__sparkle.s1 { top: 8px;  right: 10px; animation-delay: 0s; }
.qetc-pd-kstage--won__sparkle.s2 { top: 38%;  left: 8px;   animation-delay: 1.4s; font-size: 12px; }
.qetc-pd-kstage--won__sparkle.s3 { bottom: 14px; right: 16px; animation-delay: 2.8s; font-size: 14px; }
@keyframes qetcWonSparkle {
    0%, 100% { opacity: 0; transform: scale(0.6) rotate(0deg); }
    20%      { opacity: 1; transform: scale(1.1) rotate(14deg); }
    40%      { opacity: 0.4; transform: scale(0.85) rotate(-8deg); }
    60%      { opacity: 0; transform: scale(0.6) rotate(0deg); }
}
/* Print: tone the gold down a touch + freeze animations */
@media print {
    .qetc-pd-kstage--won::before,
    .qetc-pd-kstage--won__sparkles { display: none !important; }
    .qetc-pd-kstage--won {
        background: linear-gradient(180deg, #fef3c7 0%, #fbd24e 100%);
        box-shadow: 0 0 0 1px #b8860b inset;
    }
}

/* =============================================================================
 * v1.17.22 — Per-stage dwell-time chip on each Kanban card.
 *
 * Shows avg historical dwell ("⏱ avg 3.2 d"). Tooltip carries the current
 * queue age + sample size for the historical figure. The chip flips to
 * `.is-stale` (amber) when the live queue is sitting >1.5x the historical
 * average — admin's signal that the current admission backlog is unusually
 * slow — and `.is-fresh` (green) when it's under half.
 * ========================================================================== */
.qetc-pd-kstage__dwell {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    color: var(--qetc-muted, #64748b);
    background: rgba(15, 23, 42, 0.03);
    border-radius: 999px;
    padding: 2px 8px;
    margin-top: 4px;
    align-self: flex-start;
    line-height: 1.4;
    cursor: help;
    border: 1px solid transparent;
}
.qetc-pd-kstage__dwellicn { font-size: 11px; opacity: 0.7; }
.qetc-pd-kstage__dwelllbl {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.65;
}
.qetc-pd-kstage__dwellv {
    font-weight: 700;
    color: var(--qetc-text, #0f172a);
    font-variant-numeric: tabular-nums;
}
.qetc-pd-kstage__dwell.is-stale {
    color: #b45309;
    background: #fef3c7;
    border-color: rgba(180, 83, 9, 0.18);
}
.qetc-pd-kstage__dwell.is-stale .qetc-pd-kstage__dwellv {
    color: #92400e;
}
.qetc-pd-kstage__dwell.is-stale::after {
    content: " ⚠";
    font-size: 10px;
    opacity: 0.7;
}
.qetc-pd-kstage__dwell.is-fresh {
    color: #16a34a;
    background: #dcfce7;
    border-color: rgba(22, 163, 74, 0.18);
}
.qetc-pd-kstage__dwell.is-fresh .qetc-pd-kstage__dwellv {
    color: #166534;
}

/* Hide the chip on the gold Won column (no concept of dwell there). */
.qetc-pd-kstage--won .qetc-pd-kstage__dwell { display: none; }

/* =================================================================
   v1.18.0 — Finance Dashboard module styling.
   Gold/emerald palette to read as "the money module" without
   clashing with the gold Won card in CRM (we use a deeper
   amber for the pill and a green for positive cash KPIs).
   ================================================================= */
.qetc-modbar__btn--finance.is-active .qetc-modbar__dot { background: #b47707; }

.qetc-module__pill--finance {
    background: rgba(180, 119, 7, 0.12);
    color: #8a5a00;
    border-color: transparent;
}

/* Strong KPI variant — used for "Net cash flow" which is the
   headline number on this module. */
.qetc-kpi--strong { background: linear-gradient(180deg, rgba(180,119,7,0.06), rgba(180,119,7,0.02)); }
.qetc-kpi--strong .qetc-kpi__value { font-size: 28px; font-weight: 700; }
.qetc-fin-kpi--negative { color: var(--qetc-red); }

/* Runway block — landscape card with metrics + a top-right badge. */
.qetc-fin-runway {
    background: var(--qetc-surface);
    border: 1px solid var(--qetc-hair);
    border-radius: 14px;
    padding: 16px 20px;
    margin: 20px 0;
}
.qetc-fin-runway__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.qetc-fin-runway__head h4 { margin: 0; font-size: 14px; font-weight: 600; }
.qetc-fin-runway__badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 980px;
    background: var(--qetc-surface-2);
    color: var(--qetc-text-2, #555);
}
.qetc-fin-runway__badge--ok   { background: rgba(52,199,89,0.14);  color: #1d8a40; }
.qetc-fin-runway__badge--warn { background: rgba(255,59,48,0.12);  color: var(--qetc-red); }
.qetc-fin-runway__body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}
.qetc-fin-runway__metric {
    display: flex; flex-direction: column;
    padding: 10px 12px;
    background: var(--qetc-surface-2);
    border-radius: 10px;
}
.qetc-fin-runway__label { font-size: 11px; color: var(--qetc-text-2, #666); text-transform: uppercase; letter-spacing: 0.04em; }
.qetc-fin-runway__metric strong { font-size: 18px; margin-top: 2px; font-weight: 600; }
.qetc-fin-runway__metric--eoy strong { color: #8a5a00; }

/* =================================================================
   v1.18.0 — Finance CEO redesign
   Password gate + global toggles + KPI cards + donut.
   Palette taken from the mockup: primary #185FA5, accent gold #BA7517,
   pos green #639922, warn amber #854F0B, neg red #A32D2D.
   ================================================================= */

/* Password gate — class-based lock. When the parent section has
   .is-locked, only the gate shows and the body is fully hidden. */
.qetc-module--finance.is-locked      #qetc-fin-body { display: none !important; }
.qetc-module--finance:not(.is-locked) #qetc-fin-gate { display: none !important; }
.qetc-fin-gate {
    display: flex; align-items: center; justify-content: center;
    min-height: 320px;
    padding: 40px 20px;
}
.qetc-fin-gate__card {
    background: var(--qetc-surface);
    border: 1px solid var(--qetc-hair);
    border-radius: 14px;
    padding: 28px 32px;
    max-width: 380px;
    text-align: center;
}
.qetc-fin-gate__card h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.qetc-fin-gate__card p  { margin: 0 0 16px; font-size: 13px; color: var(--qetc-text-2, #555); }
.qetc-fin-gate__card input[type="password"] {
    width: 100%; padding: 10px 12px; font-size: 14px;
    border: 1px solid var(--qetc-hair-2); border-radius: 8px;
}
.qetc-fin-gate__card button { width: 100%; margin-top: 10px; padding: 9px 14px; }
.qetc-fin-gate__err { color: var(--qetc-red); font-size: 12px; margin: 10px 0 0; }

/* Global toggle strip */
.qetc-fin-controls {
    display: flex; flex-wrap: wrap; gap: 12px 22px;
    padding: 14px 0 18px;
    border-bottom: 1px solid var(--qetc-hair);
    margin-bottom: 16px;
}
.qetc-fin-ctlgrp { display: inline-flex; gap: 6px; align-items: center; }
.qetc-fin-ctlgrp.is-disabled { opacity: 0.35; pointer-events: none; }
.qetc-fin-ctlgrp__label {
    font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
    font-weight: 600; color: var(--qetc-text-2, #666); margin-right: 4px;
}
.qetc-fin-ctlgrp button {
    background: transparent; border: 1px solid var(--qetc-hair-2);
    color: var(--qetc-text); font-family: inherit; font-size: 12px;
    padding: 6px 12px; border-radius: 980px; cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.qetc-fin-ctlgrp button:hover { background: rgba(24,95,165,0.06); }
.qetc-fin-ctlgrp button.is-active {
    background: rgba(24,95,165,0.10); color: #185FA5; border-color: #185FA5;
    font-weight: 600;
}

.qetc-fin-section-label {
    font-size: 10px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--qetc-text-2, #666);
    margin: 18px 0 10px;
}

/* KPI grids — 4 columns top, 3 columns bottom; collapse on narrow viewports. */
.qetc-fin-kpis { display: grid; gap: 14px; }
.qetc-fin-kpis--4 { grid-template-columns: repeat(4, 1fr); }
.qetc-fin-kpis--3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) {
    .qetc-fin-kpis--4, .qetc-fin-kpis--3 { grid-template-columns: repeat(2, 1fr); }
}

.qetc-fin-card {
    background: var(--qetc-surface);
    border: 1px solid var(--qetc-hair);
    border-radius: 14px;
    padding: 16px 18px 14px;
    display: flex; flex-direction: column; gap: 4px;
    min-height: 110px;
}
.qetc-fin-card--accent { border-color: #185FA5; }
.qetc-fin-card__label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--qetc-text-2, #666); }
.qetc-fin-card__value { font-size: 22px; font-weight: 600; margin: 2px 0 4px; }
.qetc-fin-card__sub   { font-size: 12px; color: var(--qetc-text-2, #666); }
.qetc-fin-card__yoy   { font-size: 11px; font-weight: 500; margin-top: 4px; }
.qetc-fin-card__yoy--up   { color: #3B6D11; }
.qetc-fin-card__yoy--down { color: #A32D2D; }

.qetc-fin-progress {
    height: 4px; background: rgba(24,95,165,0.10); border-radius: 999px;
    margin: 6px 0 4px; overflow: hidden;
}
.qetc-fin-progress__fill { height: 100%; background: #185FA5; border-radius: 999px; transition: width 0.4s ease; }
.qetc-fin-progress__fill--done { background: #639922; }

.qetc-fin-badge {
    display: inline-block; align-self: flex-start;
    padding: 2px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 600;
    background: rgba(24,95,165,0.08); color: #185FA5;
}
.qetc-fin-badge--up      { background: #EAF3DE; color: #3B6D11; }
.qetc-fin-badge--warn    { background: #FAEEDA; color: #854F0B; }
.qetc-fin-badge--neutral { background: var(--qetc-surface-2); color: var(--qetc-text-2, #555); }

/* Two-column row for trend + donut */
.qetc-fin-twocol {
    display: grid; gap: 14px;
    grid-template-columns: 1.6fr 1fr;
    margin: 20px 0;
}
@media (max-width: 900px) {
    .qetc-fin-twocol { grid-template-columns: 1fr; }
}
.qetc-fin-donut {
    padding: 18px 20px;
    display: flex; flex-direction: column;
}
.qetc-fin-donut canvas {
    max-height: 220px !important;
    height: 220px !important;
    display: block;
}
.qetc-fin-donut__legend {
    list-style: none; padding: 0; margin: 14px 0 0;
    display: flex; flex-direction: column; gap: 4px;
    font-size: 12px;
}
.qetc-fin-donut__legend li { display: flex; align-items: center; gap: 8px; }
.qetc-fin-donut__dot { width: 10px; height: 10px; border-radius: 2px; flex: 0 0 auto; }
.qetc-fin-donut__nm  { flex: 1; color: var(--qetc-text-2, #555); }
.qetc-fin-donut__v   { font-weight: 600; color: var(--qetc-text); }

/* Trend chart wrapper — Chart.js with responsive:true +
   maintainAspectRatio:false will fill its parent vertically with no
   limit, which on a wide page blows the canvas up to ~1000px tall.
   Cap the height here so the chart stays a reasonable size at every
   viewport width. */
.qetc-fin-trend { padding: 18px 20px; }
.qetc-fin-trend h4 { margin: 0 0 12px; font-size: 14px; font-weight: 600; }
.qetc-fin-trend canvas {
    display: block;
    width: 100% !important;
    max-height: 320px;
    height: 320px !important;
}

/* Goal-seek widget */
.qetc-fin-goal { padding: 18px 20px; }
.qetc-fin-goal h4 { margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.qetc-fin-goal__desc { margin: 0 0 14px; font-size: 13px; color: var(--qetc-text-2, #555); line-height: 1.45; }
.qetc-fin-goal__form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    align-items: end;
}
.qetc-fin-goal__form label {
    display: flex; flex-direction: column;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    color: var(--qetc-text-2, #555); letter-spacing: 0.04em;
}
.qetc-fin-goal__form input,
.qetc-fin-goal__form select {
    margin-top: 4px;
    padding: 8px 10px;
    border: 1px solid var(--qetc-hair-2);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
}
.qetc-fin-goal__out {
    margin-top: 14px;
    padding: 14px 16px;
    background: linear-gradient(180deg, rgba(180,119,7,0.10), rgba(180,119,7,0.04));
    border: 1px solid rgba(180,119,7,0.30);
    border-radius: 12px;
    font-size: 14px;
}
.qetc-fin-goal__out strong { font-size: 22px; color: #8a5a00; margin-right: 4px; }
.qetc-fin-goal__out span { display: block; font-size: 12px; color: var(--qetc-text-2, #555); margin-top: 4px; }

/* v1.17.26 — "Restart Gateway" button variant. Same shape as the
   regular Sync Now button but tinted red so the destructive action
   reads as such at a glance. Hover deepens the tint to telegraph
   "yes, this really does reboot the device". */
.qetc-sync-btn--danger {
    color: var(--qetc-red);
    border-color: rgba(255, 59, 48, 0.45);
}
.qetc-sync-btn--danger:hover {
    background: var(--qetc-red-soft);
    border-color: var(--qetc-red);
    color: var(--qetc-red);
    box-shadow: 0 0 0 3px var(--qetc-red-soft);
}
.qetc-sync-btn--danger:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* v1.17.23 — Month label inside the Won card header. */
.qetc-pd-kstage--won__month {
    display: block;
    width: 100%;
    margin-top: 2px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.18);
}

/* =================================================================
   v1.17.25 — GSM v2 (Bevatel SIP trunk webhook) module styling.
   Lives alongside the existing Dinstar Call Center pill in the
   module bar. Pill uses purple so it visually reads as the "new"
   sibling and won't be confused with the established green
   Dinstar pill during the cutover period.
   ================================================================= */
.qetc-modbar__btn--gsmv2.is-active .qetc-modbar__dot { background: var(--qetc-purple); }

.qetc-module__pill--gsmv2 {
    background: rgba(175, 82, 222, 0.12);
    color: var(--qetc-purple);
    border-color: transparent;
}

/* Empty / waiting-for-data banner shown when no Bevatel webhook has
   landed for the current window. Inline because this module is the
   only place we have this exact "still being set up" presentation. */
.qetc-bv-empty {
    margin: 14px 0 22px;
    padding: 18px 22px;
    border: 1px dashed rgba(175, 82, 222, 0.45);
    background: rgba(175, 82, 222, 0.06);
    border-radius: 14px;
    color: var(--qetc-text);
}
.qetc-bv-empty h4 {
    margin: 0 0 6px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--qetc-purple);
}
.qetc-bv-empty p {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--qetc-text-2, #555);
}

/* Inline <audio> player + open-link in the calls table. Kept
   compact so the table row doesn't bloat when recordings come
   in. */
.qetc-bv-rec-link {
    display: inline-block;
    margin-left: 6px;
    font-size: 12px;
    color: var(--qetc-purple);
    text-decoration: none;
}
.qetc-bv-rec-link:hover { text-decoration: underline; }

/* =================================================================
   v1.18.2 — Dark mode
   Activated by adding data-qetc-theme="dark" to html/body. Every
   colour token in .qetc-dash is overridden; cards/inputs/charts
   inherit from the variables, so the whole UI flips together.
   ================================================================= */
[data-qetc-theme="dark"] body.qetc-has-dashboard,
[data-qetc-theme="dark"] html.qetc-has-dashboard {
    background: #0b0d10 !important;
}
[data-qetc-theme="dark"] .qetc-dash {
    color-scheme: dark;
    --qetc-bg:         #0b0d10;
    --qetc-surface:    #16191e;
    --qetc-surface-2:  #1d2127;
    --qetc-hair:       #2a2e35;
    --qetc-hair-2:     #353a42;
    --qetc-text:       #e7e9ec;
    --qetc-text-2:     #b6bac1;
    --qetc-muted:      #8a8f97;
    --qetc-muted-2:    #6c727a;

    --qetc-blue:        #4d97ff;
    --qetc-blue-soft:   rgba(77,151,255,0.15);
    --qetc-green:       #4bd163;
    --qetc-green-soft:  rgba(75,209,99,0.16);
    --qetc-red:         #ff5b50;
    --qetc-red-soft:    rgba(255,91,80,0.16);
    --qetc-orange:      #ffa233;
    --qetc-orange-soft: rgba(255,162,51,0.16);
    --qetc-yellow:      #ffd54a;
    --qetc-purple:      #c07cf0;
    --qetc-teal:        #6fd1f7;

    --qetc-shadow-1: 0 1px 2px rgba(0,0,0,0.45), 0 1px 1px rgba(0,0,0,0.30);
    --qetc-shadow-2: 0 4px 18px rgba(0,0,0,0.55), 0 1px 2px rgba(0,0,0,0.35);
}

/* Inputs / selects / textareas across all modules — these often
   skip the variables and inherit native form colours. Force them. */
[data-qetc-theme="dark"] .qetc-dash input,
[data-qetc-theme="dark"] .qetc-dash select,
[data-qetc-theme="dark"] .qetc-dash textarea {
    background: var(--qetc-surface-2);
    color: var(--qetc-text);
    border-color: var(--qetc-hair-2);
}
[data-qetc-theme="dark"] .qetc-dash input::placeholder { color: var(--qetc-muted-2); }

/* The Finance gate has its own card backdrop — re-tone for dark. */
[data-qetc-theme="dark"] .qetc-fin-gate__card {
    background: var(--qetc-surface);
    border-color: var(--qetc-hair);
}
[data-qetc-theme="dark"] .qetc-fin-card,
[data-qetc-theme="dark"] .qetc-card,
[data-qetc-theme="dark"] .qetc-fin-runway,
[data-qetc-theme="dark"] .qetc-fin-trend,
[data-qetc-theme="dark"] .qetc-fin-donut,
[data-qetc-theme="dark"] .qetc-fin-goal {
    background: var(--qetc-surface);
    border-color: var(--qetc-hair);
}
[data-qetc-theme="dark"] .qetc-fin-progress { background: rgba(77,151,255,0.18); }
[data-qetc-theme="dark"] .qetc-fin-badge { background: rgba(77,151,255,0.16); color: #8db8ff; }
[data-qetc-theme="dark"] .qetc-fin-badge--neutral { background: var(--qetc-surface-2); color: var(--qetc-text-2); }
[data-qetc-theme="dark"] .qetc-fin-badge--up      { background: rgba(75,209,99,0.16);  color: #7fe39a; }
[data-qetc-theme="dark"] .qetc-fin-badge--warn    { background: rgba(255,162,51,0.16); color: #ffc987; }
[data-qetc-theme="dark"] .qetc-fin-card--accent   { border-color: #4d97ff; }
[data-qetc-theme="dark"] .qetc-fin-card__yoy--up   { color: #7fe39a; }
[data-qetc-theme="dark"] .qetc-fin-card__yoy--down { color: #ff8a82; }

/* The toggle button in the dashboard header */
.qetc-theme-toggle {
    background: var(--qetc-surface);
    border: 1px solid var(--qetc-hair-2);
    color: var(--qetc-text);
    width: 36px; height: 36px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: background 0.15s, transform 0.15s, border-color 0.15s;
}
.qetc-theme-toggle:hover { background: var(--qetc-blue-soft); border-color: var(--qetc-blue); transform: scale(1.05); }
.qetc-theme-toggle__sun { display: inline; }
.qetc-theme-toggle__moon { display: none; }
[data-qetc-theme="dark"] .qetc-theme-toggle__sun  { display: none; }
[data-qetc-theme="dark"] .qetc-theme-toggle__moon { display: inline; }
