/* ============================================================
   PROJECTCUBE — COMPONENT LIBRARY
   Requires design-tokens.css loaded first.
   New "pc-" prefixed classes — adopt page by page, nothing here
   overrides existing Bootstrap/legacy classes, so rollout is safe.
   ============================================================ */

@keyframes pcFadeUp   { from { opacity:0; transform: translateY(14px);} to { opacity:1; transform: translateY(0);} }
@keyframes pcShimmer  { 0% { background-position:-200% 0; } 100% { background-position:200% 0; } }
@keyframes pcSpin     { to { transform: rotate(360deg); } }
@keyframes pcCubeSpin {
    0%   { transform: rotateX(-30deg) rotateY(0deg); }
    100% { transform: rotateX(-30deg) rotateY(360deg); }
}
@keyframes pcPulse    { 0%,100% { opacity:1; } 50% { opacity:.55; } }

/* ============================================================
   BUTTONS
   ============================================================ */
.pc-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--pc-font-body); font-weight: 600; font-size: var(--pc-text-sm);
    padding: 10px 20px; border-radius: var(--pc-radius-sm); border: 1px solid transparent;
    cursor: pointer; white-space: nowrap; line-height: 1;
    transition: transform var(--pc-duration-fast) var(--pc-ease), box-shadow var(--pc-duration-fast) var(--pc-ease), filter var(--pc-duration-fast) ease;
}
.pc-btn:hover  { transform: translateY(-2px); }
.pc-btn:active { transform: translateY(0) scale(.97); }

.pc-btn--primary { background: var(--pc-gradient-brand); color: #fff; box-shadow: var(--pc-shadow-md); }
.pc-btn--primary:hover { box-shadow: var(--pc-shadow-glow); filter: brightness(1.04); }

.pc-btn--accent { background: var(--pc-gradient-accent); color: #fff; box-shadow: var(--pc-shadow-md); }
.pc-btn--accent:hover { box-shadow: 0 12px 24px -8px rgba(6,182,212,.4); }

.pc-btn--ghost { background: var(--pc-surface); color: var(--pc-primary); border-color: var(--pc-border-strong); }
.pc-btn--ghost:hover { background: var(--pc-primary-soft); border-color: var(--pc-primary); }

.pc-btn--success { background: var(--pc-success); color: #fff; }
.pc-btn--danger  { background: var(--pc-danger); color: #fff; }
.pc-btn--sm { padding: 6px 14px; font-size: var(--pc-text-xs); }
.pc-btn--icon { padding: 10px; border-radius: var(--pc-radius-pill); }
.pc-btn[disabled] { opacity: .5; pointer-events: none; }

/* ============================================================
   CARDS
   ============================================================ */
.pc-card {
    background: var(--pc-surface); border: 1px solid var(--pc-border);
    border-radius: var(--pc-radius-lg); box-shadow: var(--pc-shadow-sm);
    padding: var(--pc-space-5); animation: pcFadeUp var(--pc-duration-slow) var(--pc-ease) both;
    transition: transform var(--pc-duration) var(--pc-ease), box-shadow var(--pc-duration) var(--pc-ease);
}

/* 3D tilt-on-hover variant — use for project/task/summary cards */
.pc-card--tilt { position: relative; transform-style: preserve-3d; will-change: transform; overflow: hidden; }
.pc-card--tilt:hover {
    transform: perspective(1100px) translateY(-6px) rotateX(2.5deg) rotateY(-1.5deg) scale(1.01);
    box-shadow: var(--pc-shadow-3d); border-color: #cdd5f5;
}
.pc-card--tilt::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: var(--pc-gradient-sheen); background-size: 220% 100%; background-position: 200% 0; opacity: 0;
    transition: opacity var(--pc-duration) ease;
}
.pc-card--tilt:hover::after { opacity: 1; animation: pcShimmer 1.1s ease; }

.pc-card__title { font-family: var(--pc-font-display); font-weight: 600; font-size: var(--pc-text-md); color: var(--pc-ink); margin-bottom: var(--pc-space-1); }
.pc-card__meta  { font-size: var(--pc-text-xs); color: var(--pc-ink-faint); }

/* KPI / stat card for dashboards */
.pc-stat-card {
    background: var(--pc-surface); border: 1px solid var(--pc-border); border-radius: var(--pc-radius-lg);
    padding: var(--pc-space-5); box-shadow: var(--pc-shadow-sm); position: relative; overflow: hidden;
}
.pc-stat-card::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--pc-gradient-brand);
}
.pc-stat-card__icon {
    width: 42px; height: 42px; border-radius: var(--pc-radius-sm); display: flex; align-items: center; justify-content: center;
    background: var(--pc-primary-soft); color: var(--pc-primary); font-size: 18px; margin-bottom: var(--pc-space-3);
}
.pc-stat-card__value { font-family: var(--pc-font-mono); font-weight: 700; font-size: var(--pc-text-2xl); color: var(--pc-ink); }
.pc-stat-card__label { font-size: var(--pc-text-xs); color: var(--pc-ink-faint); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.pc-stat-card__trend { font-size: var(--pc-text-xs); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; margin-top: var(--pc-space-2); }
.pc-stat-card__trend--up   { color: var(--pc-success); }
.pc-stat-card__trend--down { color: var(--pc-danger); }

/* ============================================================
   BADGES / STATUS PILLS
   ============================================================ */
.pc-badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; border-radius: var(--pc-radius-pill);
    font-size: var(--pc-text-xs); font-weight: 600; line-height: 1.4;
}
.pc-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pc-badge--success { background: var(--pc-success-soft); color: var(--pc-success); }
.pc-badge--warning { background: var(--pc-warning-soft); color: var(--pc-warning); }
.pc-badge--danger  { background: var(--pc-danger-soft); color: var(--pc-danger); }
.pc-badge--info    { background: var(--pc-info-soft); color: var(--pc-info); }
.pc-badge--neutral { background: var(--pc-surface-alt); color: var(--pc-ink-soft); border: 1px solid var(--pc-border); }

/* ============================================================
   TABLES
   ============================================================ */
.pc-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--pc-surface); border-radius: var(--pc-radius-lg); overflow: hidden; box-shadow: var(--pc-shadow-sm); }
.pc-table thead th {
    background: var(--pc-surface-alt); font-family: var(--pc-font-body); font-weight: 600; font-size: var(--pc-text-xs);
    text-transform: uppercase; letter-spacing: .04em; color: var(--pc-ink-soft); text-align: left;
    padding: var(--pc-space-3) var(--pc-space-4); border-bottom: 1px solid var(--pc-border); position: sticky; top: 0; z-index: var(--pc-z-sticky);
}
.pc-table tbody td { padding: var(--pc-space-3) var(--pc-space-4); font-size: var(--pc-text-sm); color: var(--pc-ink); border-bottom: 1px solid var(--pc-border); }
.pc-table tbody tr:last-child td { border-bottom: none; }
.pc-table tbody tr { transition: background var(--pc-duration-fast) ease; }
.pc-table tbody tr:nth-child(even) { background: var(--pc-surface-alt); }
.pc-table tbody tr:hover { background: var(--pc-primary-soft); }

/* ============================================================
   FORMS
   ============================================================ */
.pc-field { margin-bottom: var(--pc-space-4); }
.pc-field label { display: block; font-size: var(--pc-text-sm); font-weight: 600; color: var(--pc-ink-soft); margin-bottom: 6px; }
.pc-input, .pc-select, .pc-textarea {
    width: 100%; font-family: var(--pc-font-body); font-size: var(--pc-text-base); color: var(--pc-ink);
    background: var(--pc-surface); border: 1.5px solid var(--pc-border); border-radius: var(--pc-radius-sm);
    padding: 10px 14px; transition: border-color var(--pc-duration-fast) ease, box-shadow var(--pc-duration-fast) ease;
}
.pc-input:focus, .pc-select:focus, .pc-textarea:focus {
    outline: none; border-color: var(--pc-primary); box-shadow: 0 0 0 3px var(--pc-primary-soft);
}

/* ============================================================
   MODAL
   ============================================================ */
.pc-modal-backdrop { position: fixed; inset: 0; background: rgba(16,24,40,.5); backdrop-filter: blur(2px); z-index: var(--pc-z-modal-backdrop); animation: pcFadeUp .2s ease both; }
.pc-modal {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); z-index: var(--pc-z-modal);
    background: var(--pc-surface); border-radius: var(--pc-radius-lg); box-shadow: var(--pc-shadow-3d);
    padding: var(--pc-space-6); width: min(520px, 92vw); animation: pcFadeUp var(--pc-duration) var(--pc-ease) both;
}

/* ============================================================
   TABS
   ============================================================ */
.pc-tabs { display: flex; gap: var(--pc-space-2); border-bottom: 1px solid var(--pc-border); margin-bottom: var(--pc-space-5); }
.pc-tab {
    padding: 10px 4px; margin-right: var(--pc-space-5); font-size: var(--pc-text-sm); font-weight: 600; color: var(--pc-ink-faint);
    border-bottom: 2px solid transparent; cursor: pointer; transition: color var(--pc-duration-fast) ease, border-color var(--pc-duration-fast) ease;
}
.pc-tab:hover { color: var(--pc-ink); }
.pc-tab.active { color: var(--pc-primary); border-bottom-color: var(--pc-primary); }

/* ============================================================
   3D CUBE LOADER — signature element, ties directly to the
   "ProjectCube" brand. Use .pc-loader-overlay for full-page
   loads, .pc-loader-inline for buttons / small regions.
   ============================================================ */
.pc-cube-scene {
    width: 46px; height: 46px; perspective: 220px; display: inline-block;
}
.pc-cube {
    width: 100%; height: 100%; position: relative; transform-style: preserve-3d;
    animation: pcCubeSpin 2.2s linear infinite;
}
.pc-cube__face {
    position: absolute; width: 46px; height: 46px; background: var(--pc-gradient-brand);
    opacity: .92; border: 1px solid rgba(255,255,255,.25);
}
.pc-cube__face--front  { transform: translateZ(23px); }
.pc-cube__face--back   { transform: rotateY(180deg) translateZ(23px); }
.pc-cube__face--right  { transform: rotateY(90deg) translateZ(23px); background: var(--pc-gradient-accent); }
.pc-cube__face--left   { transform: rotateY(-90deg) translateZ(23px); background: var(--pc-gradient-accent); }
.pc-cube__face--top    { transform: rotateX(90deg) translateZ(23px); opacity: .6; }
.pc-cube__face--bottom { transform: rotateX(-90deg) translateZ(23px); opacity: .6; }

.pc-loader-overlay {
    position: fixed; inset: 0; z-index: var(--pc-z-loader);
    background: rgba(245,246,251,.88); backdrop-filter: blur(3px);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--pc-space-4);
}
.pc-loader-overlay .pc-cube-scene { width: 64px; height: 64px; perspective: 300px; }
.pc-loader-overlay .pc-cube__face { width: 64px; height: 64px; }
.pc-loader-overlay .pc-cube__face--front, .pc-loader-overlay .pc-cube__face--back { transform: translateZ(32px); }
.pc-loader-overlay .pc-cube__face--back { transform: rotateY(180deg) translateZ(32px); }
.pc-loader-overlay .pc-cube__face--right { transform: rotateY(90deg) translateZ(32px); }
.pc-loader-overlay .pc-cube__face--left { transform: rotateY(-90deg) translateZ(32px); }
.pc-loader-overlay .pc-cube__face--top { transform: rotateX(90deg) translateZ(32px); }
.pc-loader-overlay .pc-cube__face--bottom { transform: rotateX(-90deg) translateZ(32px); }
.pc-loader-label { font-family: var(--pc-font-body); font-weight: 600; font-size: var(--pc-text-sm); color: var(--pc-ink-soft); animation: pcPulse 1.6s ease-in-out infinite; }

.pc-loader-inline { display: inline-flex; align-items: center; gap: 8px; }
.pc-loader-inline .pc-cube-scene { width: 20px; height: 20px; perspective: 100px; }
.pc-loader-inline .pc-cube__face { width: 20px; height: 20px; }
.pc-loader-inline .pc-cube__face--front, .pc-loader-inline .pc-cube__face--back { transform: translateZ(10px); }
.pc-loader-inline .pc-cube__face--back { transform: rotateY(180deg) translateZ(10px); }
.pc-loader-inline .pc-cube__face--right { transform: rotateY(90deg) translateZ(10px); }
.pc-loader-inline .pc-cube__face--left { transform: rotateY(-90deg) translateZ(10px); }
.pc-loader-inline .pc-cube__face--top { transform: rotateX(90deg) translateZ(10px); }
.pc-loader-inline .pc-cube__face--bottom { transform: rotateX(-90deg) translateZ(10px); }

/* Skeleton shimmer for content that's loading (tables/cards) */
.pc-skeleton {
    background: linear-gradient(90deg, #eef0f6 25%, #f7f8fc 37%, #eef0f6 63%);
    background-size: 400% 100%; animation: pcShimmer 1.4s ease infinite; border-radius: var(--pc-radius-sm);
}

/* ============================================================
   CHART LOADING STATE — shown inside .pc-chart-card while data
   is being fetched. Mimics the shape of the chart that's coming,
   so the loading state itself looks intentional, not blank.
   Toggle with pcChartTheme.loading(containerEl, true/false).
   ============================================================ */
.pc-chart-loading { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding: 4px 4px 0; }
.pc-chart-loading__bar {
    flex: 1; border-radius: 6px 6px 0 0;
    background: linear-gradient(180deg, var(--pc-primary-soft), #eef0f6 60%, #eef0f6);
    background-size: 100% 400%; animation: pcShimmerVert 1.6s ease-in-out infinite;
}
.pc-chart-loading__bar:nth-child(1){ height:55%; animation-delay:.0s;}
.pc-chart-loading__bar:nth-child(2){ height:80%; animation-delay:.1s;}
.pc-chart-loading__bar:nth-child(3){ height:40%; animation-delay:.2s;}
.pc-chart-loading__bar:nth-child(4){ height:95%; animation-delay:.3s;}
.pc-chart-loading__bar:nth-child(5){ height:65%; animation-delay:.4s;}
.pc-chart-loading__bar:nth-child(6){ height:75%; animation-delay:.5s;}
@keyframes pcShimmerVert { 0%,100% { opacity:.55; } 50% { opacity:1; } }

/* 3D flip-in reveal for a chart/canvas once real data has loaded — the
   card tips forward from a slight tilt into place, like it's settling
   onto the page. Add class .pc-chart-reveal to the canvas/svg wrapper
   right after you swap the loader out. */
@keyframes pcChartReveal {
    from { opacity: 0; transform: perspective(900px) rotateX(14deg) translateY(14px) scale(.97); }
    to   { opacity: 1; transform: perspective(900px) rotateX(0deg) translateY(0) scale(1); }
}
.pc-chart-reveal { animation: pcChartReveal .55s var(--pc-ease) both; transform-origin: bottom center; }

/* ============================================================
   GANTT WRAPPER — for the frappe-gantt SVG (#taskGanttChart).
   Same elevated-card treatment as charts, plus a subtle depth
   line under each task bar row so the timeline reads as "raised".
   ============================================================ */
.pc-gantt-card {
    background: var(--pc-surface); border: 1px solid var(--pc-border); border-radius: var(--pc-radius-lg);
    padding: var(--pc-space-5); box-shadow: var(--pc-shadow-sm); overflow-x: auto;
    transition: box-shadow var(--pc-duration) var(--pc-ease);
}
.pc-gantt-card:hover { box-shadow: var(--pc-shadow-md); }
.pc-gantt-card .gantt .bar { filter: drop-shadow(0 3px 4px rgba(67,56,202,.25)); }
.pc-gantt-card .gantt .bar-progress { fill: var(--pc-primary) !important; }
.pc-gantt-card .gantt .bar { fill: var(--pc-primary-soft) !important; stroke: var(--pc-primary); stroke-width: 1; }
.pc-gantt-card .gantt .today-highlight { fill: rgba(6,182,212,.15) !important; }

/* Count-up KPI numbers — pair with pcChartTheme.countUp() in chart-theme.js */
.pc-countup { display: inline-block; }

/* ============================================================
   CHART / GRAPH CONTAINERS — perspective tilt + elevated frame,
   so Chart.js / ApexCharts canvases sit in a "3D" panel.
   Pair with static/js/chart-theme.js for gradient-filled series.
   ============================================================ */
.pc-chart-card {
    background: var(--pc-surface); border: 1px solid var(--pc-border); border-radius: var(--pc-radius-lg);
    padding: var(--pc-space-5); box-shadow: var(--pc-shadow-sm); position: relative;
    transform-style: preserve-3d; transition: transform var(--pc-duration) var(--pc-ease), box-shadow var(--pc-duration) var(--pc-ease);
}
.pc-chart-card:hover { transform: perspective(1400px) rotateX(1.2deg) translateY(-3px); box-shadow: var(--pc-shadow-lg); }
.pc-chart-card__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--pc-space-4); }
.pc-chart-card__title { font-family: var(--pc-font-display); font-weight: 600; font-size: var(--pc-text-md); color: var(--pc-ink); }

/* ============================================================
   SIDEBAR / NAVBAR polish (additive, structure untouched) —
   apply pc-sidebar / pc-navbar classes alongside existing ones.
   ============================================================ */
.pc-navbar { background: var(--pc-surface); border-bottom: 1px solid var(--pc-border); box-shadow: var(--pc-shadow-xs); }
.pc-sidebar { background: var(--pc-surface); border-right: 1px solid var(--pc-border); }
.pc-sidebar .nav-link { font-size: var(--pc-text-sm); font-weight: 500; color: var(--pc-ink-soft); border-radius: var(--pc-radius-sm); transition: background var(--pc-duration-fast) ease, color var(--pc-duration-fast) ease; }
.pc-sidebar .nav-link:hover { background: var(--pc-primary-soft); color: var(--pc-primary); }
.pc-sidebar .nav-link.active { background: var(--pc-gradient-brand); color: #fff; box-shadow: var(--pc-shadow-md); }

/* ============================================================
   PROJECT CARD (.card.v1) — All Projects page only.
   Scoped to body.pc-all-projects so this never touches the cards
   built by manager_dashboard.js / dashboard_new.js elsewhere —
   those keep their original look untouched. The AJAX function
   that builds this markup (project_new.js) is never modified —
   this only restyles what it already outputs.
   ============================================================ */
body.pc-all-projects .card.v1 {
    background: var(--pc-surface) !important;
    border: 1px solid var(--pc-border) !important;
    border-radius: var(--pc-radius-lg) !important;
    box-shadow: var(--pc-shadow-sm) !important;
    padding: var(--pc-space-5) !important;
    color: var(--pc-ink) !important;
    height: 100%; box-sizing: border-box; cursor: pointer;
    transform-style: preserve-3d; will-change: transform; position: relative; overflow: hidden;
    transition: transform var(--pc-duration) var(--pc-ease), box-shadow var(--pc-duration) var(--pc-ease), border-color var(--pc-duration-fast) ease;
    animation: pcFadeUp var(--pc-duration-slow) var(--pc-ease) both;
}
body.pc-all-projects .card.v1:hover {
    transform: perspective(1100px) translateY(-6px) rotateX(2.5deg) rotateY(-1.5deg) scale(1.01);
    box-shadow: var(--pc-shadow-3d) !important; border-color: #cdd5f5 !important;
}
body.pc-all-projects .card.v1::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: var(--pc-gradient-sheen); background-size: 220% 100%; background-position: 200% 0; opacity: 0;
    transition: opacity var(--pc-duration) ease;
}
body.pc-all-projects .card.v1:hover::after { opacity: 1; animation: pcShimmer 1.1s ease; }

body.pc-all-projects .card.v1 h4 {
    font-family: var(--pc-font-display); font-weight: 500; font-size: var(--pc-text-md); color: var(--pc-ink) !important;
    margin: 4px 0 6px; line-height: 1.35; word-break: break-word;
}
body.pc-all-projects .card.v1 > h6 { font-family: var(--pc-font-body); font-weight: 300; font-size: var(--pc-text-sm); color: var(--pc-ink-soft) !important; margin-bottom: var(--pc-space-3); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
body.pc-all-projects .card.v1 .circle-name {
    background: var(--pc-gradient-brand) !important; color: #fff !important; font-weight: 600;
    border-radius: var(--pc-radius-sm) !important; box-shadow: 0 6px 14px -4px rgba(67,56,202,.5);
    width: 42px !important; height: 42px !important; line-height: normal !important;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* Row 1: avatar + status chip — natural widths, status pinned right,
   both vertically centered on the same line. */
body.pc-all-projects .card.v1 .grid-container:first-of-type {
    display: flex !important; align-items: center !important; justify-content: space-between !important;
    width: 100% !important; margin-bottom: var(--pc-space-4);
}
body.pc-all-projects .card.v1 .grid-container:first-of-type br { display: none; }
body.pc-all-projects .card.v1 .grid-container:first-of-type .status h6 {
    font-family: var(--pc-font-body); font-weight: 600 !important; font-size: var(--pc-text-xs) !important;
    color: var(--pc-success) !important; text-transform: uppercase; letter-spacing: .03em;
    background: var(--pc-success-soft); padding: 4px 12px; border-radius: var(--pc-radius-pill); margin: 0 !important;
}

/* Row 2: "Total Tasks" + "Completion" — equal columns, labels and
   values aligned to the same baseline, progress bar directly under
   its label instead of floating.
   Using flex here (not grid) is deliberate: the page's own CSS has
   ".status { justify-self: end; }" for the small status badge, and
   project_new.js reuses .status as the wrapper around the Completion
   bar too. justify-self only has an effect inside a grid — so in a
   grid that rule was shrinking the wrapper to fit its text and
   collapsing the bar to a sliver. In flex, justify-self is simply
   ignored, so the conflict can't happen at all, not just "loses". */
body.pc-all-projects .card.v1 .grid-container:first-of-type ~ .grid-container {
    display: flex !important; align-items: flex-start !important; gap: var(--pc-space-5) !important;
    width: 100% !important; margin: var(--pc-space-2) 0 var(--pc-space-4);
}
body.pc-all-projects .card.v1 .grid-container:first-of-type ~ .grid-container > div {
    flex: 1 1 0; min-width: 0;
}
body.pc-all-projects .card.v1 .grid-container:first-of-type ~ .grid-container h6 {
    font-family: var(--pc-font-body); font-weight: 500 !important; font-size: var(--pc-text-xs) !important;
    color: var(--pc-ink-soft) !important; margin: 0 0 8px !important; text-transform: uppercase; letter-spacing: .02em;
}
body.pc-all-projects .card.v1 .grid-container:first-of-type ~ .grid-container .status { width: 100%; }

/* Completion — the percentage lives OUTSIDE the fill bar, in its own
   label beside the track (.pc-progress-row is built by
   project-view-switcher.js). With the number inside the fill, a 6%-wide
   fill has no room for its own text and they collide; outside, the label
   always has space no matter the percentage. */
body.pc-all-projects .card.v1 .pc-progress-row { display: flex; align-items: center; gap: 8px; width: 100%; }
body.pc-all-projects .card.v1 .pc-progress-row .progress-container { flex: 1 1 auto; }
body.pc-all-projects .card.v1 .pc-progress-label {
    font-family: var(--pc-font-mono); font-size: 11px; font-weight: 600; color: var(--pc-ink);
    min-width: 36px; text-align: right; flex-shrink: 0; line-height: 1;
}
body.pc-all-projects .card.v1 .progress-container { width: 100% !important; background: var(--pc-surface-alt) !important; border: 1px solid var(--pc-border); border-radius: var(--pc-radius-pill) !important; height: 10px !important; overflow: hidden; position: relative; }
body.pc-all-projects .card.v1 .progress-bar {
    background: var(--pc-gradient-brand) !important; background-size: 200% 100% !important; animation: pcShimmer 2.6s linear infinite;
    height: 100% !important; border-radius: var(--pc-radius-pill) !important;
    /* FALLBACK when project-view-switcher.js hasn't processed this bar
       (stale file, cache, script error): keep the number visible inside
       the fill — possibly tight at tiny percentages, but never invisible. */
    color: #fff !important; font-size: 9px !important; font-weight: 600 !important;
    line-height: 10px !important; text-align: right; padding: 0 6px !important;
    white-space: nowrap; min-width: 0;
}
/* Once the script HAS moved the number into the external label, it stamps
   the bar with data-pct — only then is the in-bar text suppressed. */
body.pc-all-projects .card.v1 .progress-bar[data-pct] {
    font-size: 0 !important; line-height: 0 !important; color: transparent !important; padding: 0 !important;
}
body.pc-all-projects .card.v1 .participants { display: flex; align-items: center; }
body.pc-all-projects .card.v1 .participants img { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--pc-surface); object-fit: cover; margin-right: -8px; box-shadow: var(--pc-shadow-xs); }
body.pc-all-projects .card.v1 .add-participant {
    background: var(--pc-primary-soft) !important; color: var(--pc-primary) !important; border: 1px solid #cfe0ff !important;
    border-radius: var(--pc-radius-pill) !important; width: 26px !important; height: 26px !important; display: flex !important;
    align-items: center; justify-content: center; margin-left: 6px; cursor: pointer;
}
body.pc-all-projects .card.v1 .dates { text-align: right !important; font-size: var(--pc-text-xs) !important; color: var(--pc-ink-faint) !important; line-height: 1.7; }
body.pc-all-projects .card.v1 > div:not(.grid-container) {
    display: flex !important; justify-content: space-between !important; align-items: center !important;
    margin-top: var(--pc-space-3); padding-top: var(--pc-space-3); border-top: 1px solid var(--pc-border);
}

/* ============================================================
   ALL PROJECTS — search bar height only.
   Outer grid/columns are left exactly as Bootstrap's .row/.col-lg-6
   already had them — that layout wasn't broken, only card *insides*
   needed alignment work (below).
   ============================================================ */
body.pc-all-projects #search-bar {
    height: 42px; border: 1.5px solid var(--pc-border-strong); border-radius: var(--pc-radius-sm);
    font-family: var(--pc-font-body); font-size: var(--pc-text-sm); box-shadow: none;
}
body.pc-all-projects #search-bar:focus { border-color: var(--pc-primary); box-shadow: 0 0 0 3px var(--pc-primary-soft); outline: none; }

/* Status filter dropdown — matches the search bar / view switcher row.
   The hide class uses !important so it can't be overridden by the search
   box's inline show(): a card is visible only if BOTH filters allow it. */
.pc-status-filter {
    height: 42px; padding: 0 36px 0 14px; min-width: 160px;
    background: var(--pc-surface); color: var(--pc-ink);
    border: 1.5px solid var(--pc-border-strong); border-radius: var(--pc-radius-sm);
    font-family: var(--pc-font-body); font-weight: 500; font-size: var(--pc-text-sm);
    cursor: pointer; appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475467' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; background-size: 14px;
    transition: border-color var(--pc-duration-fast) ease, box-shadow var(--pc-duration-fast) ease;
}
.pc-status-filter:hover { border-color: var(--pc-primary); box-shadow: var(--pc-shadow-xs); }
.pc-status-filter:focus { outline: none; border-color: var(--pc-primary); box-shadow: 0 0 0 3px var(--pc-primary-soft); }

.project-card.pc-status-hide { display: none !important; }


/* ============================================================
   PROJECT VIEW SWITCHER — Explorer-style menu for the All
   Projects page. Cards / List / Details only — Compact Cards and
   Tiles were tried and dropped as unnecessary for this data.
   List/Details are pure CSS reflow + read-only DOM scraping of
   the same .card.v1 markup — project_new.js is never touched.
   ============================================================ */
.pc-view-switcher { position: relative; display: inline-block; }
.pc-view-switcher-btn {
    display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px;
    background: var(--pc-surface); border: 1.5px solid var(--pc-border-strong); border-radius: var(--pc-radius-sm);
    font-family: var(--pc-font-body); font-weight: 500; font-size: var(--pc-text-sm); color: var(--pc-ink);
    cursor: pointer; transition: border-color var(--pc-duration-fast) ease, box-shadow var(--pc-duration-fast) ease;
}
.pc-view-switcher-btn:hover { border-color: var(--pc-primary); box-shadow: var(--pc-shadow-xs); }
.pc-view-switcher-btn svg { width: 16px; height: 16px; }
.pc-view-switcher-btn .pc-chevron { width: 12px; height: 12px; opacity: .6; transition: transform var(--pc-duration-fast) ease; }
.pc-view-switcher.open .pc-chevron { transform: rotate(180deg); }

.pc-view-menu {
    position: absolute; top: calc(100% + 8px); right: 0; min-width: 200px; z-index: 500; /* above .pc-table's sticky thead (200) */
    background: var(--pc-surface); border: 1px solid var(--pc-border); border-radius: var(--pc-radius); box-shadow: var(--pc-shadow-lg);
    padding: 6px; display: none; animation: pcFadeUp .18s var(--pc-ease) both;
}
.pc-view-switcher.open .pc-view-menu { display: block; }
.pc-view-menu__item {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--pc-radius-sm);
    font-size: var(--pc-text-sm); font-weight: 400; color: var(--pc-ink); cursor: pointer; position: relative;
}
.pc-view-menu__item:hover { background: var(--pc-surface-alt); }
.pc-view-menu__item svg { width: 17px; height: 17px; color: var(--pc-ink-soft); flex-shrink: 0; }
.pc-view-menu__item::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--pc-primary); position: absolute; left: -2px; opacity: 0; }
.pc-view-menu__item.active { font-weight: 600; color: var(--pc-primary); padding-left: 16px; }
.pc-view-menu__item.active svg { color: var(--pc-primary); }
.pc-view-menu__item.active::before { opacity: 1; left: 3px; }

/* --- view: list (single-column compact rows) ---
   Rebuilt as a 4-column grid mapped directly to .card.v1's real
   direct children: [avatar+badge] [title] [tasks+completion] [dates].
   Long project codes now truncate with an ellipsis instead of
   wrapping and colliding with the columns next to them. */
.cards-wrapper[data-view="list"] .project-card { flex: 0 0 100% !important; max-width: 100% !important; }
.cards-wrapper[data-view="list"] .card.v1 {
    display: grid !important;
    grid-template-columns: auto minmax(160px, 1fr) minmax(240px, auto) auto;
    column-gap: var(--pc-space-4);
    align-items: center;
    padding: 12px var(--pc-space-4) !important;
}
.cards-wrapper[data-view="list"] .card.v1 > h6 { display: none; }
.cards-wrapper[data-view="list"] .card.v1 h4 {
    margin: 0; font-size: var(--pc-text-base); min-width: 0;
    display: block; -webkit-line-clamp: unset;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cards-wrapper[data-view="list"] .card.v1 .grid-container:first-of-type { margin: 0 !important; }
.cards-wrapper[data-view="list"] .card.v1 .grid-container:first-of-type ~ .grid-container {
    display: flex !important; align-items: center; gap: var(--pc-space-5); margin: 0 !important; min-width: 0;
}
.cards-wrapper[data-view="list"] .card.v1 .grid-container:first-of-type ~ .grid-container > div { flex: 0 0 auto; white-space: nowrap; }
.cards-wrapper[data-view="list"] .card.v1 .grid-container:first-of-type ~ .grid-container h6 { margin: 0 !important; white-space: nowrap; }
.cards-wrapper[data-view="list"] .card.v1 .pc-progress-row { width: 170px; flex-shrink: 0; }
.cards-wrapper[data-view="list"] .card.v1 .progress-container { width: 100% !important; flex-shrink: 1; }
.cards-wrapper[data-view="list"] .card.v1 > div:not(.grid-container) {
    margin: 0; padding: 0; border: none; justify-content: flex-end;
}
.cards-wrapper[data-view="list"] .card.v1 .dates { white-space: nowrap; }
.cards-wrapper[data-view="list"] .card.v1 .participants img,
.cards-wrapper[data-view="list"] .card.v1 .add-participant { display: none; }

/* --- view: details (handled by JS — hides cards, shows table) --- */
.cards-wrapper[data-view="details"] { display: none !important; }
.pc-view-details-table { display: none; }
.pc-view-details-table.active { display: block; }
.pc-view-details-table .pc-table tbody tr { cursor: pointer; }

/* ============================================================
   TOP LOADING BAR — thin gradient line under the navbar,
   GitHub/YouTube style. Cheaper than the full-page cube loader
   for small actions (table refresh, filter apply, tab switch).
   Control with pcUI.progress.start() / .done() from ui-kit.js.
   ============================================================ */
.pc-progress-bar {
    position: fixed; top: 0; left: 0; height: 3px; width: 0%;
    background: var(--pc-gradient-brand); z-index: var(--pc-z-loader);
    transition: width .4s ease, opacity .3s ease .2s;
    box-shadow: 0 0 8px rgba(67,56,202,.6);
}
.pc-progress-bar.pc-progress-bar--done { transition: width .2s ease, opacity .3s ease; opacity: 0; }

/* ============================================================
   EMPTY STATES — for zero-task projects, empty filters, empty
   search results. Swap a blank table for intent + a next action.
   ============================================================ */
.pc-empty-state {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    padding: var(--pc-space-8) var(--pc-space-5); gap: var(--pc-space-2);
}
.pc-empty-state__art { width: 108px; height: 108px; color: var(--pc-primary); opacity: .85; margin-bottom: var(--pc-space-2); }
.pc-empty-state__title { font-family: var(--pc-font-display); font-weight: 500; font-size: var(--pc-text-lg); color: var(--pc-ink); }
.pc-empty-state__body { font-size: var(--pc-text-sm); color: var(--pc-ink-soft); max-width: 340px; }
.pc-empty-state .pc-btn { margin-top: var(--pc-space-3); }

/* ============================================================
   STAGGERED ENTRANCE — apply .pc-stagger to a card/grid
   container; each direct child animates in with an incrementing
   delay. Set delays via pcUI.stagger(el) in ui-kit.js (works for
   any number of children); the nth-child rules below are a
   no-JS fallback for up to 10 items.
   ============================================================ */
.pc-stagger > * { opacity: 0; animation: pcFadeUp .5s var(--pc-ease) forwards; }
.pc-stagger > *:nth-child(1)  { animation-delay: .00s; }
.pc-stagger > *:nth-child(2)  { animation-delay: .05s; }
.pc-stagger > *:nth-child(3)  { animation-delay: .10s; }
.pc-stagger > *:nth-child(4)  { animation-delay: .15s; }
.pc-stagger > *:nth-child(5)  { animation-delay: .20s; }
.pc-stagger > *:nth-child(6)  { animation-delay: .25s; }
.pc-stagger > *:nth-child(7)  { animation-delay: .30s; }
.pc-stagger > *:nth-child(8)  { animation-delay: .35s; }
.pc-stagger > *:nth-child(9)  { animation-delay: .40s; }
.pc-stagger > *:nth-child(10) { animation-delay: .45s; }

/* ============================================================
   DARK MODE TOGGLE — a small pill switch, drop anywhere in the
   navbar. Wire up with pcUI.initThemeToggle() from ui-kit.js.
   ============================================================ */
.pc-theme-toggle {
    position: relative; width: 46px; height: 26px; border-radius: var(--pc-radius-pill);
    background: var(--pc-border-strong); border: none; cursor: pointer; flex-shrink: 0;
    transition: background var(--pc-duration) ease;
}
.pc-theme-toggle::before {
    content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%;
    background-color: var(--pc-surface); background-repeat: no-repeat; background-position: center; background-size: 13px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F59E0B' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4'/%3E%3C/svg%3E");
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--pc-shadow-sm); transition: transform var(--pc-duration) var(--pc-ease);
}
[data-theme="dark"] .pc-theme-toggle { background: var(--pc-primary); }
[data-theme="dark"] .pc-theme-toggle::before {
    transform: translateX(20px);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236366F1'%3E%3Cpath d='M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 1020.354 15.354z'/%3E%3C/svg%3E");
}

@media (prefers-reduced-motion: reduce) {
    /* NOTE: .pc-cube deliberately NOT included — a loading spinner that
       stops moving looks broken/stuck. Progress indicators stay animated. */
    .pc-card, .pc-card--tilt, .pc-chart-card, body.pc-all-projects .card.v1 { animation: none !important; transition: none !important; }
    .pc-card--tilt:hover, .pc-chart-card:hover, body.pc-all-projects .card.v1:hover { transform: translateY(-3px); }
}

/* ============================================================
   TOASTS & CONFIRM DIALOG — modern replacements for the swal
   popups, rendered by pc-notify.js. Token-driven, so they
   follow dark mode automatically where it's enabled.
   ============================================================ */
.pc-toast-stack {
    position: fixed; top: 16px; right: 16px; z-index: 1100;
    display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 32px));
}
.pc-toast {
    position: relative; display: flex; align-items: flex-start; gap: 10px;
    background: var(--pc-surface); border: 1px solid var(--pc-border); border-radius: var(--pc-radius);
    box-shadow: var(--pc-shadow-lg); padding: 12px 34px 12px 12px; overflow: hidden;
    animation: pcToastIn .3s var(--pc-ease) both;
}
@keyframes pcToastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
.pc-toast--leaving { opacity: 0; transform: translateX(24px); transition: opacity .25s ease, transform .25s ease; }
.pc-toast__icon { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.pc-toast__icon svg { width: 100%; height: 100%; }
.pc-toast--success .pc-toast__icon { color: var(--pc-success); }
.pc-toast--error   .pc-toast__icon { color: var(--pc-danger); }
.pc-toast--warning .pc-toast__icon { color: var(--pc-warning); }
.pc-toast--info    .pc-toast__icon,
.pc-toast--question .pc-toast__icon { color: var(--pc-info); }
.pc-toast__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pc-toast__title { font-family: var(--pc-font-body); font-weight: 600; font-size: var(--pc-text-sm); color: var(--pc-ink); line-height: 1.35; }
.pc-toast__text { font-size: var(--pc-text-xs); color: var(--pc-ink-soft); line-height: 1.4; }
.pc-toast__close {
    position: absolute; top: 6px; right: 8px; background: none; border: none; cursor: pointer;
    color: var(--pc-ink-faint); font-size: 16px; line-height: 1; padding: 4px;
}
.pc-toast__close:hover { color: var(--pc-ink); }
.pc-toast__progress {
    position: absolute; left: 0; bottom: 0; height: 2.5px; width: 100%;
    background: var(--pc-gradient-brand); transform-origin: left;
    animation-name: pcToastProgress; animation-timing-function: linear; animation-fill-mode: forwards;
}
.pc-toast--success .pc-toast__progress { background: var(--pc-success); }
.pc-toast--error   .pc-toast__progress { background: var(--pc-danger); }
.pc-toast--warning .pc-toast__progress { background: var(--pc-warning); }
@keyframes pcToastProgress { from { transform: scaleX(1); } to { transform: scaleX(0); } }

.pc-confirm { text-align: center; width: min(420px, 92vw); }
.pc-confirm__icon {
    width: 56px; height: 56px; margin: 0 auto var(--pc-space-4); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.pc-confirm__icon svg { width: 30px; height: 30px; }
.pc-confirm__icon--success  { background: var(--pc-success-soft); color: var(--pc-success); }
.pc-confirm__icon--error    { background: var(--pc-danger-soft); color: var(--pc-danger); }
.pc-confirm__icon--warning  { background: var(--pc-warning-soft); color: var(--pc-warning); }
.pc-confirm__icon--info,
.pc-confirm__icon--question { background: var(--pc-info-soft); color: var(--pc-info); }
.pc-confirm__title { font-family: var(--pc-font-display); font-weight: 500; font-size: var(--pc-text-lg); color: var(--pc-ink); margin-bottom: var(--pc-space-2); }
.pc-confirm__text { font-size: var(--pc-text-sm); color: var(--pc-ink-soft); line-height: var(--pc-lh-normal); }
.pc-confirm__actions { display: flex; justify-content: center; gap: var(--pc-space-3); margin-top: var(--pc-space-5); }

/* ============================================================
   LOGO LOADER — the ProjectCube mark itself: three isometric
   cubes drop in staggered, bounce on landing, hold assembled,
   fade, loop. Deliberately NOT disabled under reduced motion —
   a frozen loading indicator reads as "stuck".
   ============================================================ */
.pc-logo-loader { width: 132px; height: 123px; overflow: visible; }
.pc-logo-loader path { stroke: #fff; stroke-width: 5; stroke-linejoin: round; }
.pc-logo-face--top   { fill: #3B82F6; }
.pc-logo-face--left  { fill: #2563EB; }
.pc-logo-face--right { fill: #1D4ED8; }

.pc-logo-cube {
    transform-box: fill-box; transform-origin: 50% 50%;
    animation: pcLogoDrop 2.1s cubic-bezier(.3,.9,.3,1) infinite both;
}
.pc-logo-cube__pos--1 .pc-logo-cube { animation-delay: 0s; }
.pc-logo-cube__pos--2 .pc-logo-cube { animation-delay: .16s; }
.pc-logo-cube__pos--3 .pc-logo-cube { animation-delay: .32s; }

@keyframes pcLogoDrop {
    0%   { transform: translateY(-110px); opacity: 0; }
    16%  { transform: translateY(0);      opacity: 1; }  /* land */
    24%  { transform: translateY(-13px); }                /* bounce */
    32%  { transform: translateY(0); }
    74%  { transform: translateY(0); opacity: 1; }        /* hold the logo */
    88%  { transform: translateY(14px); opacity: 0; }     /* drop away */
    100% { transform: translateY(14px); opacity: 0; }
}

.pc-logo-shadow {
    fill: #101828; opacity: .10;
    transform-box: fill-box; transform-origin: 50% 50%;
    animation: pcLogoShadow 2.1s ease-in-out infinite;
}
@keyframes pcLogoShadow {
    0%   { transform: scaleX(.55); opacity: .04; }
    32%  { transform: scaleX(1);   opacity: .12; }
    74%  { transform: scaleX(1);   opacity: .12; }
    92%  { transform: scaleX(.6);  opacity: .04; }
    100% { transform: scaleX(.55); opacity: .04; }
}
