/* ============================================
   EMUsage Meter — visionOS Glass Material System
   ============================================ */

/* === CSS Variables (theme-driven) === */
:root {
    /* Glass material */
    --glass-tint: rgba(40,20,80,0.35);
    --glass-blur: 40px;
    --glass-border: rgba(255,255,255,0.18);
    --glass-border-top: rgba(255,255,255,0.35);
    --specular-opacity: 0.15;
    --shadow-intensity: 0.5;
    --shadow-color-rgb: 0,0,0; /* theme glow color; overridden by applyTheme() */

    /* Colors */
    --accent: #a78bfa;
    --text-primary: rgba(255,255,255,0.95);
    --text-secondary: rgba(255,255,255,0.6);
    --text-tertiary: rgba(255,255,255,0.35);

    /* Status colors */
    --green: #4ade80;
    --yellow: #facc15;
    --orange: #fb923c;
    --red: #ef4444;
    --grey: #9ca3af;
    --blue: #60a5fa;

    /* Radii */
    --radius-widget: 20px;
    --radius-inner: 12px;
    --radius-sm: 8px;

    /* Background */
    --img-opacity: 0.8;
    --window-opacity: 1;

    /* Spring easing */
    --spring: linear(
        0, 0.009, 0.035 2.1%, 0.141, 0.281 6.7%, 0.723 12.9%,
        0.938 16.7%, 1.017, 1.077, 1.121, 1.149 24.3%,
        1.159, 1.163, 1.161, 1.154 29.9%, 1.067 36.2%,
        1.012 40.8%, 0.991 44.2%, 0.978, 0.975 50.5%,
        0.994 57.4%, 1.004 63.3%, 1.007 75%, 1
    );
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    --wails-resize: all; /* enable resize cursors on all edges for frameless window */
}

html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    background: rgba(0,0,0,0.01); /* near-zero prevents Windows click-through on transparent window */
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
    font-size: 13px;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    user-select: none;
}

#app {
    width: 100%; height: 100%;
    position: relative;
}

/* === Background Layers === */
.canvas-bg {
    position: fixed; inset: 0; z-index: -2;
    background: var(--canvas-bg, radial-gradient(ellipse at 30% 20%, #2a1050 0%, #0f0a1a 50%, #050208 100%));
    opacity: var(--window-opacity);
    --wails-draggable: drag;
}

.bg-image {
    position: fixed; inset: 0; z-index: -1;
    background-size: cover;
    background-position: center;
    opacity: var(--img-opacity);
    pointer-events: none;
}

/* === Floating Header (hidden — replaced by tray menu + context menu) === */
.floating-header {
    display: none !important;
}

.header-left, .header-right, .header-center {
    display: flex; align-items: center; gap: 8px;
    --wails-draggable: no-drag;
}

.header-left { min-width: 120px; }
.header-center { flex: 1; justify-content: center; }
.header-right { min-width: 120px; justify-content: flex-end; }

.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--grey);
    flex-shrink: 0;
}

.status-dot.green { background: var(--green); }
.status-dot.yellow { background: var(--yellow); }
.status-dot.orange { background: var(--orange); }
.status-dot.red { background: var(--red); }
.status-dot.pulse { animation: pulse 2s ease-in-out infinite; }

.status-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Provider switcher in header */
.provider-switcher {
    display: flex;
    background: rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 2px;
    border: 1px solid rgba(255,255,255,0.1);
}

.provider-btn {
    padding: 4px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.provider-btn.active {
    background: rgba(255,255,255,0.15);
    color: var(--text-primary);
}

.provider-btn:hover:not(.active) {
    background: rgba(255,255,255,0.08);
}

/* === Glass Buttons === */
.btn-glass {
    width: 32px; height: 32px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    flex-shrink: 0;
}

.btn-glass:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.2);
    color: var(--text-primary);
}

.btn-glass:active { transform: scale(0.93); }

.btn-glass.btn-sm { width: 26px; height: 26px; }

.btn-primary {
    padding: 10px 24px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-inner);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
}

.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.97); }

/* === Widget Canvas === */
.widget-canvas {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    overflow: auto;
    --wails-draggable: drag;
    cursor: move;
}

/* Widgets themselves are NOT draggable (they have their own drag via JS) */
.widget, .widget * {
    --wails-draggable: no-drag;
}

/* === Widget Glass Panel === */
.widget {
    position: absolute;
    cursor: default;
    transition: box-shadow 0.3s ease;
}

.widget-glass {
    position: relative;
    background: var(--glass-tint);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.8) brightness(1.1);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.8) brightness(1.1);
    border: 1px solid var(--glass-border);
    border-top-color: var(--glass-border-top);
    border-radius: var(--radius-widget);
    overflow: hidden;
    box-shadow:
        0 4px 16px rgba(0,0,0, var(--shadow-intensity)),
        0 8px 40px rgba(var(--shadow-color-rgb, 0,0,0), 0.15);
}

/* Specular highlight — top light reflection */
.widget-specular {
    position: absolute; inset: 0;
    border-radius: var(--radius-widget);
    background: linear-gradient(
        180deg,
        rgba(255,255,255, var(--specular-opacity)) 0%,
        rgba(255,255,255, calc(var(--specular-opacity) * 0.3)) 20%,
        transparent 40%
    );
    pointer-events: none;
    z-index: 1;
}

.widget-content {
    position: relative; z-index: 2;
    padding: 16px;
    color: var(--text-primary);
}

/* Focused widget gets intensified glow */
.widget.focused .widget-glass {
    box-shadow:
        0 6px 24px rgba(0,0,0, calc(var(--shadow-intensity) * 1.2)),
        0 12px 60px rgba(var(--shadow-color-rgb, 0,0,0), 0.25);
    border-color: rgba(255,255,255,0.25);
}

/* === Widget Ornament Bar === */
.widget-ornament {
    display: flex; align-items: center; justify-content: center;
    gap: 8px;
    height: 28px;
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 0 0 var(--radius-widget) var(--radius-widget);
    border-top: 1px solid rgba(255,255,255,0.08);
    cursor: grab;
    user-select: none;
    transition: background 0.15s;
}

.widget-ornament:hover {
    background: rgba(255,255,255,0.1);
}

.widget-ornament:active { cursor: grabbing; }

.ornament-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.ornament-resize-handle {
    width: 20px; height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    cursor: pointer;
    transition: background 0.15s;
}

.ornament-resize-handle:hover {
    background: rgba(255,255,255,0.4);
}

.ornament-pin {
    display: flex; align-items: center; justify-content: center;
    width: 14px; height: 14px;
    margin-left: 4px;
    flex-shrink: 0;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}
.ornament-pin.pinned { opacity: 1; }
.jiggle-mode .ornament-pin:not(.pinned) {
    opacity: 0.3;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}
.jiggle-mode .ornament-pin:hover { opacity: 1; }

/* === Jiggle Mode === */
@keyframes jiggle {
    0%, 100% { transform: rotate(-0.7deg); }
    50%      { transform: rotate(0.7deg); }
}

.edit-done-btn {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: rgba(34,197,94,0.9); color: #fff;
    font-size: 13px; font-weight: 700; letter-spacing: 0.3px;
    padding: 8px 28px; border-radius: 20px;
    cursor: pointer; z-index: 10000;
    box-shadow: 0 4px 16px rgba(34,197,94,0.4);
    transition: opacity 0.15s, transform 0.15s;
    --wails-draggable: no-drag;
}
.edit-done-btn:hover { opacity: 0.9; transform: translateX(-50%) scale(1.04); }

.jiggle-mode .widget {
    animation: jiggle 0.25s ease-in-out infinite;
}

.jiggle-mode .widget:nth-child(even) {
    animation-delay: 0.125s;
}

.jiggle-mode .widget:nth-child(3n) {
    animation-duration: 0.3s;
}

.widget-close-badge {
    position: absolute; top: -8px; left: -8px;
    width: 22px; height: 22px;
    background: var(--red);
    border: 2px solid rgba(255,255,255,0.9);
    border-radius: 50%;
    color: white;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    z-index: 100;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    transition: transform 0.15s;
    line-height: 1;
}

.widget-close-badge:hover {
    transform: scale(1.15);
}

/* === Widget Size Presets === */
.widget[data-size="compact"] .widget-glass   { width: 160px; }
.widget[data-size="standard"] .widget-glass  { width: 250px; }
.widget[data-size="expanded"] .widget-glass  { width: 400px; }

/* Transition size changes with spring */
.widget .widget-glass {
    transition: width 0.4s var(--spring);
}

/* === Glass Modes === */
.glass-clear,
.glass-clear #app,
.glass-clear .widget-canvas {
    background: transparent !important;
}
.glass-clear .canvas-bg,
.glass-clear .bg-image { display: none !important; }
.glass-clear .widget-canvas { left: 6px; right: 6px; bottom: 6px; } /* resize handle edges in glass mode */
/* Streamlined mode (left-click tray): widgets float on desktop — no window chrome */
.streamlined .floating-header { display: none !important; }
.streamlined .canvas-bg,
.streamlined .bg-image { display: none !important; }
.glass-clear .overlay-view {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
/* Glass mode: NO backdrop-filter on live desktop — causes constant compositor repaints.
   Use layered semi-transparent backgrounds for a frosted look instead. */
.glass-clear .widget-glass {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    /* Frosted effect via layered background + inner glow.
       Uses --glass-tint-rgb (set by theme engine) so theme colors apply. */
    background:
        linear-gradient(180deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.02) 30%, transparent 60%),
        rgba(var(--glass-tint-rgb, 20,12,40), var(--widget-opacity, 0.8));
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow:
        0 4px 16px rgba(0,0,0,0.4),
        0 8px 40px rgba(var(--shadow-color-rgb, 0,0,0), 0.12),
        inset 0 1px 0 rgba(255,255,255,0.1);
}
/* Specular highlight is stronger in glass mode to sell the frosted look */
.glass-clear .widget-specular {
    background: linear-gradient(
        180deg,
        rgba(255,255,255,0.18) 0%,
        rgba(255,255,255,0.06) 15%,
        transparent 35%
    );
}
/* Kill ALL backdrop-filter in glass mode — each one forces compositor to resample desktop every frame */
.glass-clear * {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
/* Settings panel needs to be readable in glass mode — more opaque */
.glass-clear .settings-panel {
    background: rgba(var(--glass-tint-rgb, 20,12,40), 0.92) !important;
}
/* Glass + jiggle (edit widgets): show a visible tint so window is resizable */
.glass-clear .widget-canvas.jiggle-mode {
    background: rgba(var(--glass-tint-rgb, 20,12,40), 0.55) !important;
    border-radius: 12px;
}
/* Pause infinite animations in glass mode to prevent constant repaints */
.glass-clear .status-dot.pulse { animation: none; }
.glass-clear .zone-chip.critical { animation: none; }

.glass-frosted,
.glass-frosted #app,
.glass-frosted .widget-canvas {
    background: transparent !important;
}
.glass-frosted .canvas-bg { display: none !important; }
.glass-frosted .widget-glass {
    backdrop-filter: blur(50px) saturate(1.8) brightness(1.1);
    -webkit-backdrop-filter: blur(50px) saturate(1.8) brightness(1.1);
}
.glass-frosted .floating-header {
    background: rgba(0,0,0,0.15);
}

/* === Overlay Views (auth, loading, error) === */
.overlay-view {
    position: fixed; inset: 0; z-index: 5000;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.overlay-card {
    background: var(--glass-tint);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.8);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.8);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-widget);
    padding: 32px;
    text-align: center;
    max-width: 320px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.overlay-card h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.overlay-card p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.loading-spinner {
    width: 32px; height: 32px;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* === Settings Panel === */
.settings-panel {
    position: fixed; right: 16px; top: 60px;
    width: 280px;
    background: var(--glass-tint);
    backdrop-filter: blur(40px) saturate(1.8);
    -webkit-backdrop-filter: blur(40px) saturate(1.8);
    border: 1px solid var(--glass-border);
    border-top-color: var(--glass-border-top);
    border-radius: var(--radius-widget);
    padding: 20px;
    z-index: 10000;
    box-shadow:
        0 8px 40px rgba(0,0,0,0.5),
        0 4px 20px rgba(var(--shadow-color-rgb, 0,0,0), 0.15);
    overflow-y: auto;
    max-height: calc(100vh - 80px);
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.settings-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-section {
    margin-bottom: 14px;
}

.setting-label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.setting-row {
    display: flex; gap: 6px;
}

.btn-group { flex-wrap: wrap; }

.setting-opt {
    font-size: 11px !important;
    padding: 6px 10px !important;
    width: auto !important;
    height: auto !important;
}

.setting-opt.active {
    background: rgba(255,255,255,0.18) !important;
    border-color: var(--accent) !important;
    color: var(--text-primary) !important;
}

/* === Settings Tabs === */
.settings-tabs {
    display: flex; gap: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 16px;
}
.settings-tab {
    font-size: 11px; padding-bottom: 8px; cursor: pointer;
    color: var(--text-secondary); border: none; background: none;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s; font-family: inherit;
}
.settings-tab:hover { color: var(--text-primary); }
.settings-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* === Hours Tab === */
.hours-mode {
    display: flex; background: rgba(255,255,255,0.06);
    border-radius: var(--radius-sm); padding: 2px; margin-bottom: 12px;
}
.mode-btn {
    padding: 5px 10px; border-radius: 6px; font-size: 10px;
    color: var(--text-tertiary); flex: 1; text-align: center;
    cursor: pointer; border: none; background: none;
    transition: background 0.15s, color 0.15s; font-family: inherit;
}
.mode-btn:hover { color: var(--text-secondary); }
.mode-btn.active { background: rgba(167,139,250,0.2); color: var(--accent); }

.hours-row-group {
    background: rgba(255,255,255,0.04); border-radius: 8px; padding: 10px 12px;
}
.hours-row {
    background: rgba(255,255,255,0.04); border-radius: 6px; padding: 6px 10px;
    display: flex; align-items: center; gap: 6px; margin-bottom: 3px;
    transition: opacity 0.2s, background 0.2s;
}
.hours-row.disabled { opacity: 0.35; background: rgba(255,255,255,0.02); }

.day-toggle {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
}
.day-toggle.on { background: var(--green); box-shadow: 0 0 6px rgba(74,222,128,0.4); }
.day-toggle.off { background: rgba(255,255,255,0.2); }
.day-toggle:hover { transform: scale(1.4); }

.hour-input {
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 3px; padding: 2px 6px; font-size: 11px;
    color: var(--text-primary); min-width: 40px; width: 44px;
    text-align: center; font-family: inherit; outline: none;
}
.hour-input:focus { border-color: var(--accent); }
.hour-dash { font-size: 9px; color: var(--text-tertiary); }
.hour-count { font-size: 10px; color: var(--text-tertiary); margin-left: auto; }
.day-name { font-size: 10px; color: var(--text-secondary); width: 28px; }

.hours-summary {
    text-align: center; font-size: 11px; color: var(--text-tertiary);
    padding: 8px 0 4px; border-top: 1px solid rgba(255,255,255,0.06); margin-top: 10px;
}
.hours-summary span { color: var(--accent); font-weight: 500; }
.hours-reset {
    text-align: center; font-size: 10px; color: var(--text-tertiary);
    margin-top: 6px; cursor: pointer; opacity: 0.6;
}
.hours-reset:hover { opacity: 1; text-decoration: underline; }

.day-toggle-switch {
    width: 28px; height: 16px; background: rgba(255,255,255,0.1);
    border-radius: 8px; position: relative; cursor: pointer; transition: background 0.2s;
}
.day-toggle-switch::after {
    content: ''; width: 12px; height: 12px; background: rgba(255,255,255,0.3);
    border-radius: 50%; position: absolute; top: 2px; left: 2px;
    transition: transform 0.2s, background 0.2s;
}
.day-toggle-switch[data-enabled="true"] { background: rgba(74,222,128,0.3); }
.day-toggle-switch[data-enabled="true"]::after {
    transform: translateX(12px); background: var(--green);
}

.theme-grid {
    display: flex; flex-wrap: wrap; gap: 6px;
}

.theme-swatch {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
    vertical-align: middle;
}

/* Range slider */
.slider {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* Custom Colour Picker */
.ccp-trigger {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px; padding: 6px 10px;
    cursor: pointer; user-select: none;
    transition: border-color 0.15s;
}
.ccp-trigger:hover { border-color: rgba(255,255,255,0.24); }
.ccp-swatch {
    width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.2);
}
.ccp-hex {
    font-size: 11px; font-family: monospace;
    color: var(--text-secondary); letter-spacing: 0.5px;
}
.ccp-panel {
    position: fixed; z-index: 99999;
    background: rgba(18,18,26,0.97);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px; padding: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    width: 224px;
    --wails-draggable: no-drag;
}
.ccp-canvas-wrap {
    position: relative; width: 204px; height: 130px;
    border-radius: 6px; overflow: hidden; cursor: crosshair;
}
.ccp-canvas { display: block; width: 204px; height: 130px; }
.ccp-cursor {
    position: absolute; width: 10px; height: 10px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.5);
    transform: translate(-50%, -50%);
    pointer-events: none;
}
.ccp-hue {
    display: block; width: 100%; margin: 8px 0 6px;
    -webkit-appearance: none; appearance: none;
    height: 10px; border-radius: 5px; border: none; outline: none;
    background: linear-gradient(to right,
        hsl(0,100%,50%), hsl(30,100%,50%), hsl(60,100%,50%),
        hsl(90,100%,50%), hsl(120,100%,50%), hsl(150,100%,50%),
        hsl(180,100%,50%), hsl(210,100%,50%), hsl(240,100%,50%),
        hsl(270,100%,50%), hsl(300,100%,50%), hsl(330,100%,50%), hsl(360,100%,50%));
    cursor: pointer;
}
.ccp-hue::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 14px; height: 14px; border-radius: 50%;
    background: #fff; border: 2px solid rgba(0,0,0,0.3);
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    cursor: pointer;
}
.ccp-bottom {
    display: flex; align-items: center; gap: 8px; margin-top: 4px;
}
.ccp-preview {
    width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.15);
}
.ccp-input {
    flex: 1; background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px; padding: 4px 8px;
    font-size: 12px; font-family: monospace;
    color: var(--text-primary); outline: none;
    transition: border-color 0.15s;
}
.ccp-input:focus { border-color: var(--accent); }
.ccp-quick {
    display: flex; flex-wrap: wrap; gap: 7px;
    width: auto; max-width: 208px; padding: 10px;
}
.ccp-preset {
    width: 22px; height: 22px; border-radius: 50%;
    cursor: pointer; flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.15);
    transition: transform 0.1s, box-shadow 0.1s;
}
.ccp-preset:hover {
    transform: scale(1.25);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.45);
}
.ccp-more {
    width: 22px; height: 22px; border-radius: 50%;
    cursor: pointer; flex-shrink: 0;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.15);
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; color: var(--text-secondary);
    letter-spacing: 1px; line-height: 1;
    transition: background 0.1s, color 0.1s;
}
.ccp-more:hover { background: rgba(255,255,255,0.15); color: var(--text-primary); }

/* === Custom Theme Editor === */
.ct-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.ct-sublabel { font-size: 11px; color: var(--text-secondary); min-width: 60px; }
.ct-val-label { font-size: 11px; color: var(--text-secondary); min-width: 32px; text-align: right; }

/* === Widget Palette (bottom bar) === */
.widget-palette {
    position: fixed; bottom: 16px; left: 50%;
    transform: translateX(-50%);
    display: flex; gap: 8px; padding: 10px 16px;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(30px) saturate(1.5);
    -webkit-backdrop-filter: blur(30px) saturate(1.5);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 16px;
    z-index: 10000;
    max-width: 90vw;
    overflow-x: auto;
    --wails-draggable: no-drag;
}

.palette-item {
    font-size: 11px !important;
    padding: 6px 12px !important;
    width: auto !important;
    height: auto !important;
    white-space: nowrap;
}

/* === Progress Bars (volumetric capsule) === */
.progress-track {
    height: 8px;
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.5s;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute; inset: 0;
    border-radius: 4px;
    box-shadow: 0 0 8px currentColor;
    opacity: 0.5;
}

.pace-tick {
    position: absolute;
    top: -3px;
    width: 2px; height: 14px;
    background: rgba(255,255,255,0.6);
    border-radius: 1px;
    z-index: 2;
    transition: left 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Zone Chip === */
.zone-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.zone-chip.banked  { background: rgba(96,165,250,0.2); color: var(--blue); }
.zone-chip.steady  { background: rgba(74,222,128,0.2); color: var(--green); }
.zone-chip.hot     { background: rgba(251,146,60,0.2); color: var(--orange); }
.zone-chip.critical {
    background: rgba(239,68,68,0.2); color: var(--red);
    animation: chipPulse 2s ease-in-out infinite;
}

@keyframes chipPulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.3); }
    50%     { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

/* === Widget Content Utilities === */
.w-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 4px;
}

.w-value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.1;
}

.w-value-sm {
    font-size: 16px;
    font-weight: 600;
}

.w-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.w-subtext {
    font-size: 11px;
    color: var(--text-secondary);
}

.w-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 10px 0;
}

.w-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.w-stat-item label {
    display: block;
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.w-stat-item span {
    font-size: 16px;
    font-weight: 600;
}

/* Canvas inside widgets */
.widget-canvas-chart {
    width: 100%;
    border-radius: var(--radius-inner);
    display: block;
}

/* === Quota Tooltip === */
.quota-tip {
    position: fixed;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-primary);
    z-index: 20000;
    pointer-events: none;
    max-width: 240px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* === Heatmap Tooltip === */
.heatmap-tooltip {
    position: absolute;
    background: rgba(30,15,60,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.18);
    border-top-color: rgba(255,255,255,0.32);
    border-radius: 8px;
    padding: 5px 9px;
    font-size: 11px;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    opacity: 0;
    transition: opacity 120ms ease;
    z-index: 10;
}
.heatmap-tooltip.visible { opacity: 1; }
.heatmap-tooltip .hm-tip-date { color: rgba(255,255,255,0.6); font-size: 10px; }
.heatmap-tooltip .hm-tip-val  { color: rgba(255,255,255,0.95); font-weight: 600; margin-top: 2px; }

/* === Pace Ring Widget === */

/* Compact bar */
.pr-compact-top { display: flex; align-items: baseline; gap: 8px; }
.pr-compact-pct { font-size: 28px; font-weight: 700; line-height: 1; }
.pr-compact-sub { font-size: 9px; color: rgba(255,255,255,0.28); }
.pr-compact-track { height: 4px; background: rgba(255,255,255,0.06); border-radius: 2px; position: relative; margin-top: 8px; cursor: default; }
.pr-compact-fill { position: absolute; top: 0; left: 0; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #4ade80, #22c55e); transition: box-shadow 0.3s, width 0.8s cubic-bezier(0.4,0,0.2,1); }
.pr-compact-ghost { position: absolute; top: 0; height: 100%; border-radius: 0 2px 2px 0; background: rgba(56,189,248,0.18); transition: left 0.8s, width 0.8s; }
.pr-compact-tick { position: absolute; top: -3px; width: 1.5px; height: 10px; background: rgba(96,165,250,0.55); border-radius: 1px; transition: background 0.3s, box-shadow 0.3s, left 0.8s; }
.pr-compact-track:hover .pr-compact-fill { box-shadow: 0 0 10px rgba(74,222,128,0.45); }
.pr-compact-track:hover .pr-compact-tick { background: rgba(96,165,250,0.85); box-shadow: 0 0 6px rgba(96,165,250,0.3); }

/* Ring container */
.pr-ring-box { position: relative; margin: 8px auto 0; cursor: default; }

/* Multi-ring SVG transitions */
.pr-ring-fill { transition: stroke-width 0.25s ease, opacity 0.25s ease; }
.pr-ring-tick { transition: stroke 0.3s, stroke-width 0.25s; }
.pr-ring-cap  { transition: opacity 0.3s; }

/* Ring focus: dim non-focused rings */
.pr-ring-box.pr-has-focus .pr-ring-fill,
.pr-ring-box.pr-has-focus .pr-ring-tick,
.pr-ring-box.pr-has-focus .pr-ring-cap { opacity: 0.3; }
.pr-ring-box.pr-has-focus .pr-ring-fill.pr-focused,
.pr-ring-box.pr-has-focus .pr-ring-tick.pr-focused,
.pr-ring-box.pr-has-focus .pr-ring-cap.pr-focused { opacity: 1; }

/* Center text */
.pr-ring-mid { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.pr-ring-mid .pr-pct { font-weight: 700; letter-spacing: -0.03em; line-height: 1; transition: color 0.2s; }
.pr-ring-mid .pr-sub { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; margin-top: 2px; transition: opacity 0.2s; }

/* Ring legend */
.pr-ring-legend { display: flex; justify-content: center; gap: 10px; padding: 6px 0 0; font-size: 9px; color: rgba(255,255,255,0.4); }
.pr-ring-legend > span { display: flex; align-items: center; gap: 3px; cursor: default; transition: opacity 0.2s, color 0.2s; }
.pr-ring-legend > span.pr-legend-dim { opacity: 0.3; }
.pr-ring-legend > span.pr-legend-active { opacity: 1; color: rgba(255,255,255,0.85); }
.pr-legend-dot { width: 5px; height: 5px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* Expanded body: ring left, stats right */
.pr-exp-body { display: flex; align-items: flex-start; gap: 12px; margin-top: 4px; }
.pr-exp-body > div:first-child { flex-shrink: 0; }

/* Day strip */
.pr-day-strip { display: flex; justify-content: space-around; align-items: flex-end; padding: 8px 6px 2px; gap: 0; }
.pr-day-pip { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1; cursor: default; transition: transform 0.22s cubic-bezier(0.34,1.1,0.64,1); transform-origin: bottom center; }
.pr-day-bar { width: 3px; height: 10px; border-radius: 1.5px; transition: box-shadow 0.25s, background 0.2s; }
.pr-day-ltr { font-size: 9px; letter-spacing: 0.04em; color: rgba(255,255,255,0.25); transition: color 0.22s; line-height: 1; }
.pr-day-pip.today .pr-day-ltr { font-weight: 700; color: rgba(255,255,255,0.85); }

/* Pace ring tooltip (shared for ring hover + day strip) */
.pr-tooltip {
    position: fixed;
    background: rgba(10,10,18,0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 10px 13px;
    font-size: 11px;
    color: rgba(255,255,255,0.88);
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 8px 28px rgba(0,0,0,0.55);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.18s, transform 0.18s;
    z-index: 20000;
    line-height: 1.6;
}
.pr-tooltip.visible { opacity: 1; transform: translateY(0); }
.pr-tooltip .pr-tip-row { display: flex; justify-content: space-between; gap: 20px; }
.pr-tooltip .pr-tip-dim { color: rgba(255,255,255,0.4); }
.pr-tooltip .pr-tip-grn { color: #4ade80; font-weight: 600; }
.pr-tooltip .pr-tip-blu { color: #60a5fa; font-weight: 600; }
.pr-tooltip .pr-tip-sep { height: 1px; background: rgba(255,255,255,0.08); margin: 4px 0; }

/* Expanded stats panel */
.pr-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,0.05); }
.pr-stat { padding: 4px 6px; border-radius: 6px; transition: background 0.2s; cursor: default; }
.pr-stat:hover { background: rgba(255,255,255,0.035); }
.pr-stat-label { font-size: 9px; color: rgba(255,255,255,0.3); text-transform: uppercase; letter-spacing: 0.5px; }
.pr-stat-value { font-size: 14px; font-weight: 600; color: rgba(255,255,255,0.8); transition: color 0.2s; }
.pr-stat:hover .pr-stat-value { color: #fff; }
.pr-stat-unit { font-size: 10px; color: rgba(255,255,255,0.3); }

/* === Animations === */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

/* Widgets appear instantly — no entrance animation to avoid flash.
   Use .widget-enter only for newly added widgets (jiggle mode). */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

.widget-enter {
    animation: fadeIn 0.2s ease-out forwards;
}

/* === Scrollbar Styling === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* === Hero Stats (All-Time) Widget === */

/* Glow shimmer text */
@keyframes hsShimmer {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}
.hs-glow {
    background: linear-gradient(135deg, #a78bfa 0%, #22d3ee 50%, #a78bfa 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: hsShimmer 4s ease-in-out infinite;
}

/* Donut ring */
@keyframes hsDonutFill { from { stroke-dashoffset: 200; } }
.hs-ring-box { position: relative; margin: 0; cursor: default; }
.hs-ring-bg { transition: opacity 0.25s; }
.hs-ring-box:hover .hs-ring-bg { opacity: 0.4; }
.hs-ring-seg {
    transition: stroke-width 0.25s ease, filter 0.25s ease;
    animation: hsDonutFill 1s ease-out both;
}
.hs-ring-seg:hover { stroke-width: 8 !important; filter: drop-shadow(0 0 6px currentColor); }

/* Side stats (flanking the ring) */
.hs-side-stat { cursor: default; transition: transform 0.2s ease; }
.hs-side-stat .hs-val {
    font-size: 13px; font-weight: 700; line-height: 1.1;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}
.hs-side-stat .hs-lbl {
    font-size: 8px; color: rgba(255,255,255,0.3); text-transform: uppercase; letter-spacing: 0.4px;
    transition: color 0.2s ease;
}
.hs-side-stat:hover { transform: scale(1.06); }
.hs-side-stat:hover .hs-val { color: #fff; text-shadow: 0 0 12px rgba(167,139,250,0.4); }
.hs-side-stat:hover .hs-lbl { color: rgba(255,255,255,0.5); }

/* Sparkline crosshair */
.hs-spark-wrap { position: relative; cursor: crosshair; }
.hs-spark-ch {
    position: absolute; top: 0; width: 1px; height: 100%;
    background: rgba(167,139,250,0.5);
    pointer-events: none; opacity: 0;
    transition: opacity 0.15s;
}
.hs-spark-dot {
    position: absolute; width: 6px; height: 6px; border-radius: 50%;
    background: #a78bfa; box-shadow: 0 0 8px rgba(167,139,250,0.6);
    pointer-events: none; opacity: 0;
    transition: opacity 0.15s;
    transform: translate(-3px, -3px);
}

/* Model pills */
.hs-pill {
    font-size: 9px; padding: 2px 7px; border-radius: 10px;
    background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.6); font-weight: 500;
    cursor: default; display: inline-flex; align-items: center;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.hs-pill .hs-pill-pct { color: rgba(255,255,255,0.3); margin-left: 3px; transition: color 0.2s; }
.hs-pill .hs-pill-detail {
    max-width: 0; overflow: hidden; display: inline-block;
    transition: max-width 0.3s ease, margin-left 0.3s;
    margin-left: 0; font-size: 8px; color: rgba(255,255,255,0.35); white-space: nowrap;
}
.hs-pill:hover { background: rgba(255,255,255,0.14); color: #fff; box-shadow: 0 0 8px rgba(167,139,250,0.2); }
.hs-pill:hover .hs-pill-pct { color: rgba(255,255,255,0.6); }
.hs-pill:hover .hs-pill-detail { max-width: 60px; margin-left: 4px; }

/* Legend rows (expanded) */
.hs-legend-row {
    display: flex; align-items: center; gap: 5px;
    font-size: 10px; color: rgba(255,255,255,0.55); cursor: default;
    transition: color 0.2s;
}
.hs-legend-row:hover { color: rgba(255,255,255,0.85); }
.hs-legend-dot {
    width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
    transition: transform 0.2s, box-shadow 0.2s;
}
.hs-legend-row:hover .hs-legend-dot { transform: scale(1.4); }
.hs-legend-val { margin-left: auto; font-weight: 600; color: rgba(255,255,255,0.75); font-size: 11px; }

/* Tooltip (reuses pattern from pace-ring) */
.hs-tooltip {
    position: fixed; z-index: 20000;
    background: rgba(0,0,0,0.88); backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.12); border-radius: 8px;
    padding: 6px 10px; pointer-events: none;
    opacity: 0; transform: translateY(4px);
    transition: opacity 0.15s, transform 0.15s;
    font-size: 11px; color: rgba(255,255,255,0.85); white-space: nowrap;
}
.hs-tooltip.visible { opacity: 1; transform: translateY(0); }
.hs-tooltip .hs-tip-label { font-size: 9px; color: rgba(255,255,255,0.4); text-transform: uppercase; letter-spacing: 0.4px; }
.hs-tooltip .hs-tip-val { font-weight: 600; }

/* === Today Stats (ts-*) === */

/* Shimmer glow text */
.ts-glow {
    background: linear-gradient(135deg, #a78bfa 0%, #22d3ee 50%, #a78bfa 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: tsShimmer 4s ease-in-out infinite;
}
@keyframes tsShimmer {
    0%,100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Stat row */
.ts-stat-row { display: flex; justify-content: space-between; }
.ts-stat-cell { text-align: center; flex: 1; cursor: default; transition: transform 0.2s; }
.ts-stat-cell:hover { transform: scale(1.06); }
.ts-stat-cell .ts-val {
    font-size: 14px; font-weight: 700;
    transition: color 0.2s, text-shadow 0.2s;
}
.ts-stat-cell:hover .ts-val { color: #fff; text-shadow: 0 0 12px rgba(167,139,250,0.4); }
.ts-stat-cell .ts-lbl {
    font-size: 8px; color: rgba(255,255,255,0.3);
    text-transform: uppercase; letter-spacing: 0.4px;
}
.ts-stat-cell:hover .ts-lbl { color: rgba(255,255,255,0.5); }

/* Card grid */
.ts-card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

/* Card base */
.ts-card {
    position: relative;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 8px 10px;
    cursor: default;
    overflow: hidden;
    transition:
        transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
        background 0.25s,
        border-color 0.25s,
        box-shadow 0.3s;
    transform: translateY(0) scale(1);
    z-index: 1;
}
.ts-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    border-radius: 10px 10px 0 0;
    transition: height 0.25s, opacity 0.25s;
}
.ts-card:hover {
    transform: translateY(-3px) scale(1.02);
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.15);
    z-index: 5;
}
.ts-card:hover::before { height: 3px; }

/* Card accent colors */
.ts-card[data-color="cyan"]::before { background: linear-gradient(90deg, #22d3ee, #22d3ee80); }
.ts-card[data-color="cyan"]:hover { box-shadow: 0 4px 12px rgba(34,211,238,0.15), 0 8px 24px rgba(0,0,0,0.3), inset 0 1px 0 rgba(34,211,238,0.1); }
.ts-card[data-color="teal"]::before { background: linear-gradient(90deg, #06b6d4, #06b6d480); }
.ts-card[data-color="teal"]:hover { box-shadow: 0 4px 12px rgba(6,182,212,0.15), 0 8px 24px rgba(0,0,0,0.3), inset 0 1px 0 rgba(6,182,212,0.1); }
.ts-card[data-color="purple"]::before { background: linear-gradient(90deg, #8b5cf6, #8b5cf680); }
.ts-card[data-color="purple"]:hover { box-shadow: 0 4px 12px rgba(139,92,246,0.15), 0 8px 24px rgba(0,0,0,0.3), inset 0 1px 0 rgba(139,92,246,0.1); }
.ts-card[data-color="orange"]::before { background: linear-gradient(90deg, #f97316, #f9731680); }
.ts-card[data-color="orange"]:hover { box-shadow: 0 4px 12px rgba(249,115,22,0.15), 0 8px 24px rgba(0,0,0,0.3), inset 0 1px 0 rgba(249,115,22,0.1); }
.ts-card[data-color="glow"]::before {
    background: linear-gradient(90deg, #a78bfa, #22d3ee, #a78bfa);
    background-size: 200% 100%;
    animation: tsShimmer 4s ease-in-out infinite;
}
.ts-card[data-color="glow"]:hover { box-shadow: 0 4px 12px rgba(167,139,250,0.15), 0 8px 24px rgba(0,0,0,0.3), inset 0 1px 0 rgba(167,139,250,0.1); }

/* Card content */
.ts-card-label {
    font-size: 9px; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.4px;
    margin-bottom: 2px; transition: color 0.2s;
}
.ts-card-val {
    font-size: 16px; font-weight: 700;
    transition: color 0.2s, text-shadow 0.2s;
}
.ts-card:hover .ts-card-val { color: #fff; text-shadow: 0 0 10px rgba(255,255,255,0.15); }
.ts-card-sub {
    font-size: 9px; color: rgba(255,255,255,0.2);
    margin-top: 1px; transition: color 0.2s;
}
.ts-card:hover .ts-card-sub { color: rgba(255,255,255,0.35); }

/* Expanded: horizontal card layout */
.ts-card-h {
    display: flex; align-items: baseline;
    justify-content: space-between; padding: 10px 14px;
}
.ts-card-h .ts-card-left { display: flex; flex-direction: column; }
.ts-card-h .ts-card-val { font-size: 20px; }

/* === Context Menu (ctx-*) === */
.ctx-menu {
    position: fixed;
    z-index: 11000;
    min-width: 180px;
    padding: 6px;
    background: rgba(var(--glass-tint-rgb, 20,12,40), 0.92);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3);
}
.ctx-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px;
    font-size: 12px;
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}
.ctx-item:hover {
    background: rgba(255,255,255,0.1);
}
.ctx-separator {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 4px 8px;
}
.ctx-provider-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    opacity: 0.4;
}
.ctx-provider-dot.active {
    opacity: 1;
    box-shadow: 0 0 4px currentColor;
}
.glass-clear .ctx-menu {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(var(--glass-tint-rgb, 20,12,40), 0.95);
}

/* === Provider Toggle Widget (pt-*) === */
.pt-row {
    display: flex; align-items: center; justify-content: center;
    gap: 12px; padding: 4px 0;
}
.pt-icon {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    background: transparent;
    border: none;
    opacity: 0.35;
    transition: opacity 0.2s;
    user-select: none;
    pointer-events: all;
    -webkit-user-select: none;
}
.pt-icon svg { pointer-events: none; }
.pt-icon:hover:not(.active) { opacity: 0.6; }
.pt-icon.active { opacity: 1; }
.pt-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.pt-dot-pulse { animation: pulse 2s ease-in-out infinite; }
.pt-alert { font-size: 9px; color: var(--text-tertiary); text-align: center; margin-top: 2px; }

/* === Widget Adder Panel (wa-*) === */
.widget-adder-panel {
    position: fixed; right: 16px; top: 16px;
    width: 240px;
    z-index: 10000;
    background: var(--glass-tint);
    backdrop-filter: blur(40px) saturate(1.8);
    -webkit-backdrop-filter: blur(40px) saturate(1.8);
    border: 1px solid var(--glass-border);
    border-top-color: var(--glass-border-top);
    border-radius: var(--radius-widget);
    padding: 20px;
    overflow-y: auto;
    max-height: calc(100vh - 40px);
    --wails-draggable: no-drag;
    box-shadow:
        0 8px 40px rgba(0,0,0,0.5),
        0 4px 20px rgba(var(--shadow-color-rgb, 0,0,0), 0.15);
}
.wa-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 0 8px;
}
.wa-header h3 {
    font-size: 13px; font-weight: 600;
    color: var(--text-primary); margin: 0;
}
.wa-tabs {
    display: flex; gap: 2px;
    padding: 0 0 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.wa-tab {
    flex: 1; padding: 5px 0;
    font-size: 10px; font-weight: 600;
    color: var(--text-secondary);
    background: transparent; border: none;
    border-radius: 6px; cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}
.wa-tab:hover { background: rgba(255,255,255,0.06); }
.wa-tab.active {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
}
.wa-content {
    padding: 0;
}
.widget-adder-panel::-webkit-scrollbar { width: 4px; }
.widget-adder-panel::-webkit-scrollbar-track { background: transparent; }
.widget-adder-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }
.widget-adder-panel::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }
.wa-section { margin-bottom: 12px; }
.wa-cat-label {
    font-size: 9px; font-weight: 700; letter-spacing: 1px;
    color: rgba(255,255,255,0.25); text-transform: uppercase;
    padding: 8px 4px 4px; margin-bottom: 4px;
}
.wa-card {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 10px; margin-bottom: 4px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    transition: background 0.15s;
}
.wa-card:hover { background: rgba(255,255,255,0.08); }
.wa-card-info { flex: 1; min-width: 0; }
.wa-card-title { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.wa-card-desc { font-size: 9px; color: rgba(255,255,255,0.35); margin-top: 1px; }
.wa-card-actions { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.wa-provider-btn {
    width: 22px; height: 22px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.15s;
}
.wa-provider-btn:hover { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.25); }
.wa-provider-btn svg { pointer-events: none; }
.wa-add-btn {
    width: 22px; height: 22px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-secondary); font-size: 14px; font-weight: 600;
    transition: all 0.15s;
}
.wa-add-btn:hover { background: rgba(255,255,255,0.15); color: var(--text-primary); }
.wa-btn-wrap { position: relative; display: inline-flex; }
.wa-btn-added { opacity: 0.45; }
.wa-badge {
    position: absolute; top: -4px; right: -4px;
    background: rgba(34,197,94,0.9); color: #fff;
    font-size: 8px; font-weight: 700; line-height: 1;
    min-width: 13px; height: 13px; border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 3px; pointer-events: none;
}

/* Glass mode override */
.glass-clear .widget-adder-panel {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(var(--glass-tint-rgb, 20,12,40), 0.95);
}

/* === Utility === */
.hidden {
    display: none !important;
}

/* === Pace Chart (.pch-*) === */
.pch-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.pch-badges {
    display: flex;
    gap: 5px;
    align-items: center;
}

.pch-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 2px 7px;
    cursor: default;
    position: relative;
    transition: opacity 0.15s;
}
.pch-badge:hover { opacity: 0.8; }

.pch-badge-blue   { background: rgba(96,165,250,0.1);  border-color: rgba(96,165,250,0.2);  color: #60a5fa; }
.pch-badge-green  { background: rgba(74,222,128,0.1);  border-color: rgba(74,222,128,0.2);  color: #4ade80; }
.pch-badge-amber  { background: rgba(245,158,11,0.1);  border-color: rgba(245,158,11,0.2);  color: #f59e0b; }
.pch-badge-red    { background: rgba(239,68,68,0.1);   border-color: rgba(239,68,68,0.2);   color: #ef4444; }

.pch-badge-num {
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.pch-tip {
    position: fixed;
    background: rgba(13,13,18,0.95);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 10px;
    color: rgba(255,255,255,0.85);
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,0.6);
    z-index: 20000;
    pointer-events: none;
    transform: translate(-50%, -100%);
    margin-top: -6px;
}

/* Canvas wrapper — needed for absolute-positioned dot overlay */
.pch-canvas-wrap {
    position: relative;
    margin-top: 4px;
}

/* Pulsing "you are here" dot overlay */
.pch-dot {
    position: absolute;
    width: 0;
    height: 0;
    pointer-events: none;
}
.pch-dot::before {
    content: '';
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--pch-dot-color, #60a5fa);
    transform: translate(-50%, -50%);
    animation: pchDotPulse 3s ease-in-out infinite;
}
.pch-dot::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1.5px solid var(--pch-dot-color, #60a5fa);
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
    animation: pchDotRing 3s ease-in-out infinite;
}

@keyframes pchDotPulse {
    0%, 100% { opacity: 1;   transform: translate(-50%, -50%) scale(1); }
    50%       { opacity: 0.5; transform: translate(-50%, -50%) scale(0.8); }
}
@keyframes pchDotRing {
    0%   { opacity: 0;    transform: translate(-50%, -50%) scale(0.5); }
    25%  { opacity: 0.35; }
    75%  { opacity: 0;    transform: translate(-50%, -50%) scale(1.4); }
    100% { opacity: 0;    transform: translate(-50%, -50%) scale(1.4); }
}

/* ── Activity Widget (.act-*) ── */
.act-body { display: flex; align-items: center; gap: 12px; }

/* Core dot + rings */
.act-dot-wrap { position: relative; width: 48px; height: 48px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.act-core { width: 14px; height: 14px; border-radius: 50%; position: relative; z-index: 2; }
.act-ring { position: absolute; border-radius: 50%; border: 1.5px solid; animation: actRingOut 2s ease-out infinite; }
.act-ring:nth-child(2) { animation-delay: 0.6s; }
.act-ring:nth-child(3) { animation-delay: 1.2s; }
@keyframes actRingOut { 0% { width: 14px; height: 14px; opacity: 0.7; } 100% { width: 48px; height: 48px; opacity: 0; } }

/* State: active */
.act-active .act-core  { background: #4ade80; box-shadow: 0 0 10px #4ade80, 0 0 3px #4ade80; animation: actCorePulse 0.9s ease-in-out infinite; }
.act-active .act-ring  { border-color: rgba(74,222,128,0.45); animation-duration: 1.8s; }
/* State: paused */
.act-paused .act-core  { background: #f59e0b; box-shadow: 0 0 10px #f59e0b, 0 0 3px #f59e0b; animation: actCorePulse 2.8s ease-in-out infinite; }
.act-paused .act-ring  { border-color: rgba(245,158,11,0.4); animation-duration: 3.5s; }
/* State: stalled */
.act-stalled .act-core { background: #f87171; box-shadow: 0 0 10px #f87171; animation: actStalledPulse 6s ease-in-out infinite; }
.act-stalled .act-ring { border-color: rgba(248,113,113,0.3); animation-duration: 6s; }
.act-stalled .act-ring:nth-child(3) { display: none; }
/* State: idle / no data */
.act-idle .act-core    { background: #404058; animation: none; }
.act-idle .act-ring    { display: none; }

@keyframes actCorePulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.3); } }
@keyframes actStalledPulse { 0%, 85%, 100% { transform: scale(1); opacity: 0.6; } 90% { transform: scale(1.15); opacity: 1; } }

/* Text side */
.act-text { flex: 1; min-width: 0; }
.act-live-badge { display: inline-block; font-size: 9px; font-weight: 700; letter-spacing: 0.08em; color: #4ade80; border: 1px solid rgba(74,222,128,0.3); border-radius: 3px; padding: 1px 4px; text-transform: uppercase; margin-bottom: 3px; animation: actLiveBlink 1s ease-in-out infinite; }
@keyframes actLiveBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.act-status { font-size: 12px; font-weight: 700; line-height: 1.2; }
.act-timer  { font-size: 20px; font-weight: 800; line-height: 1.1; color: #e0e0e8; }
.act-sub    { font-size: 10px; color: #505068; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-more   { display: inline-block; font-size: 9px; color: #808098; background: rgba(255,255,255,0.07); border-radius: 3px; padding: 1px 5px; margin-top: 3px; }

.act-active  .act-status { color: #4ade80; }
.act-paused  .act-status { color: #f59e0b; }
.act-stalled .act-status { color: #f87171; }
.act-stalled .act-timer  { color: #f87171; }

/* Stall banner */
.act-stall-banner { background: rgba(248,113,113,0.1); border-top: 1px solid rgba(248,113,113,0.18); padding: 4px 10px; font-size: 9px; color: #f87171; letter-spacing: 0.06em; text-transform: uppercase; text-align: center; animation: actBlink 1.5s ease-in-out infinite; }
@keyframes actBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Standard: project list */
.act-list { display: flex; flex-direction: column; gap: 1px; }
.act-row { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-radius: 6px; transition: background 0.12s; }
.act-row:hover { background: rgba(255,255,255,0.03); }
.act-row:hover .act-check { opacity: 1; }
.act-row.act-muted { opacity: 0.3; }
.act-row.act-muted .act-row-dot { background: #2a2a3a !important; box-shadow: none !important; animation: none !important; }

.act-row-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.act-row-dot.active  { background: #4ade80; box-shadow: 0 0 6px #4ade80; animation: actDotPulse 0.9s ease-in-out infinite; }
.act-row-dot.paused  { background: #f59e0b; box-shadow: 0 0 4px #f59e0b; animation: actDotPulse 2.8s ease-in-out infinite; }
.act-row-dot.stalled { background: #f87171; box-shadow: 0 0 4px #f87171; animation: actDotPulse 6s ease-in-out infinite; }
.act-row-dot.idle    { background: #404058; }
@keyframes actDotPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.act-row-name  { flex: 1; font-size: 12px; color: #c0c0d8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-row-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.act-row-stats { text-align: right; }
.act-row-time  { font-size: 11px; font-weight: 700; }
.act-row-time.green  { color: #4ade80; }
.act-row-time.amber  { color: #f59e0b; }
.act-row-time.red    { color: #f87171; }
.act-row-time.dim    { color: #404058; }
.act-row-act   { font-size: 9px; color: #505068; margin-top: 1px; }

/* Checkbox (far right, hover-revealed) */
.act-check { width: 14px; height: 14px; flex-shrink: 0; border-radius: 3px; border: 1.5px solid rgba(255,255,255,0.2); background: transparent; cursor: pointer; opacity: 0; transition: opacity 0.15s, border-color 0.15s, background 0.15s; display: flex; align-items: center; justify-content: center; }
.act-check:hover { border-color: rgba(255,255,255,0.4) !important; background: rgba(255,255,255,0.06) !important; }
.act-row.act-muted .act-check { opacity: 1; border-color: rgba(74,222,128,0.4) !important; background: rgba(74,222,128,0.08) !important; }
.act-check svg { display: none; }
.act-row.act-muted .act-check svg { display: block; }
