.dashboard-v2 {
  position: relative;
  display: grid;
  gap: var(--gap, 16px);
}
.dashboard-body{display:grid;grid-template-columns: 3fr 230px;gap: 5px;}
.dash-main{display:grid;grid-template-columns: 1fr;gap: 5px;background: var(--surface);padding: 5px;border-radius: 20px;height: 91vh;overflow: auto;scrollbar-width: none;}
.dash-side{display: grid;background:var(--surface);padding: 5px;border-radius: 20px;border:1px solid var(--line);gap: 5px;height: 91vh;}
.dash-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 9vh;
  padding: 0 10px 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: center/cover no-repeat;
}
.dash-hero h1 {margin: 0;font-size: clamp(20px, 2.4vw, 30px);-webkit-text-stroke: thin;color: #fff;}
.dash-hero .muted {margin: 4px 0 0;color: #bcb8b8;font-size: 12px;font-weight: 500;}
.dash-hero .quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.skeleton { background: rgba(0,0,0,0.05); border-radius: 4px; animation: pulse 1.5s infinite; }
.skeleton-text { height: 1em; width: 60%; margin-bottom: 0.5rem; }
@keyframes pulse { 0% { opacity: 0.6; } 50% { opacity: 1; } 100% { opacity: 0.6; } }
.cards-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap, 16px);
}
#timeTrackCard header{display:flex; justify-content:space-between}
.cards-4 {display:grid;grid-template-columns: repeat(4,1fr);gap: 5px;}
.mini-card{background: linear-gradient(45deg, var(--bg), transparent);border: var(--line);border-radius: 10px;padding: 3px 5px;display: flex;flex-direction: column;gap: 5px;height: 25vh;}
.mini-card header{display:flex;justify-content: space-between;font-size: 11px;}
h1, h2{margin:0 !important}
.side-card{background: linear-gradient(31deg, var(--primary-dark)45%, var(--primary-light));padding: 10px;border-radius:12px;height: 32vh;border:1px solid var(--line);}
@media (max-width: 900px){
  .cards-3 { grid-template-columns: 1fr; }
}
.dashboard-v2 .card{background: linear-gradient(45deg, var(--bg), transparent);padding: 5px 6px;box-shadow: var(--shadow);border-radius: 10px;}
.card .btn-row{/* position: fixed; */gap:2px}
.card {
  border: var(--line);
  border-radius: 20px;
  background: var(--surface);
  padding: 12px 14px;
  margin: 0;
}
#autoListPage{display:grid;grid-template-rows: 70vh 20.6vh;gap: 2px;}
.notes.card{height: 91vh;display: grid;}
.dash-mini.list{overflow:auto;gap: 2px;border-radius: 10px;height: 140px;scrollbar-width: none;}
#calendarEvents .item{border-radius: 0;display: grid;padding: 0 3px;background: var(--dots);border: none;}
#filesPanel{height: 91vh;}
.file-card .sm{align-content:center; height: 20px !important; padding: 0 5px; font-size:12px;}
.card.file-card{background: var(--bg);max-height: 30vh;border:var(--line)}
.card.file-card:hover{border-bottom:inset 1px var(--primary-faded); transition: border-bottom .5s ease}
.file-grid{
    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(180px,1fr));
    gap: .75rem;
    min-height: 140px;
    height: 74vh;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-faded) transparent;
    position: relative;
}
.card header h2 {margin: 0;font-size: 15px;}
.kpis {display: grid;grid-template-columns: repeat(2, minmax(0, 1fr));grid-template-rows: repeat(2, 68px);margin-top: 4px;gap: 3px;}
.kpi {padding: 5px;border-radius: 10px;background: var(--bg);width: 100%;height: 100%;border: 1px solid var(--line);overflow: hidden;}
.kpi-num { font-variant-numeric: tabular-nums; font-size: 20px; }
.kpi-label { color: var(--muted); font-size: 12px; }
.monitor-week { display:flex; gap:6px; }
.monitor-week .day-pill {
  position:relative; padding:6px 10px; border-radius:999px; border:1px solid var(--line);
}
.monitor-week .day-pill::before {
  content: attr(data-slot);
  display:inline-block; width:1.5em; height:1.5em; line-height:1.5em;
  text-align:center; border-radius:999px; margin-right:6px; background:var(--surface-2);
}
.monitor-week .day-pill .after {
  font: inherit; border-radius:999px; padding:2px 6px; margin-left:6px;
  border:1px solid var(--line); opacity:.85;
}
.monitor-week .day-pill[style*="green"] { background: #0f03/0; }
.monitor-week .day-pill[style*="orange"] { background: #fa0/0; }
.monitor-week .day-pill[style*="red"] { background: #f44/0; }

/* =================================================================== */
/* Mini Calendar Widget (Consolidated and Refactored)                  */
/* =================================================================== */

/* --- Main Widget Container --- */
.mini-cal {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(56deg, var(--primary-dark) 45%, var(--primary-light));
  padding: 10px 12px;
  overflow: hidden; /* Crucial for height animation */
  /* The smooth height animation */
  transition: max-height 0.4s ease-in-out;
}
#miniCal{align-self:end}
/* --- State: Compact (Default) --- */
.mini-cal.compact {
  max-height: 30vh;
}
/* --- State: Expanded --- */
.mini-cal.expanded {
  max-height: 60vh; /* A large value to accommodate the grid */
}

/* --- Compact View: Specific Elements --- */
.mini-cal__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-weight: 600;
  color: var(--primary-light);
  /* Fade animation */
  transition: opacity 0.3s ease-out;
}

.mini-cal__date {
  font-size: 2rem; /* Larger date text */
  font-weight: 700;
  line-height: 1.1;
  margin-top: 4px;
  /* Fade animation */
  transition: font-size .3s ease, opacity 0.3s ease-out;
}

.mini-cal__meta {
  font-size: 0.9em;
  margin-top: 8px;
  display: grid;
  gap: 4px;
  /* Fade animation */
  transition: opacity 0.3s ease-out;
}

.mini-cal__weather {
  display: grid;
  align-items: center;
  grid-template-columns: repeat(1, 30px 1fr);
  gap: 5px;
  font-size: 15px;
  font-weight:bold;
  color: #fff;
  flex-direction: column;
}


/* --- Expand/Collapse Button --- */
.mini-cal__expand {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  width: 30px;
  height: 30px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: white;
  opacity: 0; /* Hidden by default */
  transition: opacity 0.2s ease, background-color 0.2s ease;
}
.mini-cal .mini-cal__expand{
  opacity:0;
}
/* Show button when hovering on the entire widget */
.mini-cal:hover .mini-cal__expand {
  opacity: 1 !important;
  pointer-events: all;
}
.mini-cal__expand:hover {
  background: rgba(255, 255, 255, 0.2);
}
.mini-cal.expanded .mini-cal__expand{position:absolute; top:2%; right:6%; width:25px; height:25px; border-radius:10px}
/* Change icon to 'collapse' when expanded */
.mini-cal.expanded .mini-cal__expand::before {
  content: "\f27d"; /* Bootstrap icon class for 'arrows-collapse' */
}
.mini-cal.expanded .mini-cal__weather{
  height:0;
  position:absolute;
  gap:2px; right:30%; top:20px;
  font-size:12px;
  font-weight:600;
  color: var(--primary-light);
  display:flex;
  flex-direction:row-reverse;
}
/* --- Content Fading Logic --- */
.mini-cal.expanded .mini-cal__date{font-size:25px; line-height:1 }
.mini-cal.expanded .mini-cal__ongoing {
  opacity: 1;
  pointer-events: none; /* Prevents interaction with invisible elements */
}
.mini-cal.compact .mini-cal__grid {
  opacity: 0;
  pointer-events: none;
}

/* --- Expanded View: The Calendar Grid --- */
/* NOTE: Using the unified class name `.mini-cal__grid` from the JS */
.mini-cal__grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  /* Fade animation (with a slight delay on fade-in) */
  transition: opacity 0.3s ease-out 0.1s;
}
.mini-cal__grid[hidden]{display:none}

/* Using the unified class name `.mini-cal__cell` from the JS */
.mini-cal__cell {
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: default;
}

.mini-cal__cell.empty {
  opacity: .13;
  background: transparent;
  border-style: dashed;
}

/* Event indicator styles */
.mini-cal__cell.day.low  { background: rgba(82,182,154,.18); border-color: rgba(82,182,154,.35); }
.mini-cal__cell.day.mid  { background: rgba(255,186,73,.18);  border-color: rgba(255,186,73,.35); }
.mini-cal__cell.day.hi   { background: rgba(244,67,54,.16);   border-color: rgba(244,67,54,.35); }

.mini-cal__cell.day:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,.1);
  transform: translateY(-1px);
  transition: all .15s ease-in-out;
}

.mini-cal__cell.is-today {
  outline: 2px solid var(--primary-light);
  border-radius: 6px;
  font-weight: 600;
}

/* === [PATCH] Weather overlay effects for dashboard hero === */
.dash-hero{position:relative;overflow:hidden;}
.dash-hero .wx-effect{ position:absolute; inset:0; pointer-events:none; }

/* Sunshine: soft radial glow and slow spin */
.dash-hero .wx-effect.wx-sunshine::before{
  content:""; position:absolute; inset:-40%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,200,.35), transparent 50%), 
              radial-gradient(circle at 70% 70%, rgba(255,255,200,.2), transparent 55%);
  animation: wxSpin 60s linear infinite; opacity:.25;
}

/* Rainfall: diagonal streaks */
.dash-hero .wx-effect.wx-rainfall::before{
  content:""; position:absolute; inset:-20%;
  background-image: repeating-linear-gradient(120deg, rgba(255,255,255,.25) 0 2px, transparent 2px 12px);
  animation: wxSlideY 800ms linear infinite; opacity:.22;
}

/* Cloudy: gentle moving haze */
.dash-hero .wx-effect.wx-cloudy::before{
  content:"";
  position: absolute;
  inset: -10%;
  background: radial-gradient(ellipse at top left, rgba(255,255,255,.18), transparent 60%),
              radial-gradient(ellipse at bottom right, rgba(255,255,255,.12), transparent 60%);
  animation: wxDrift 18s ease-in-out infinite;
  opacity: 1;
}

/* Snowfall: soft flakes */
.dash-hero .wx-effect.wx-snowfall::before{
  content:""; position:absolute; inset:0;
  background-image: radial-gradient(rgba(255,255,255,.9) 1px, transparent 1px),
                    radial-gradient(rgba(255,255,255,.7) 1px, transparent 1px),
                    radial-gradient(rgba(255,255,255,.5) 1px, transparent 1px);
  background-size: 12px 12px, 18px 18px, 24px 24px;
  background-position: 0 0, 6px -6px, -6px 6px;
  animation: wxFall 3s linear infinite;
  opacity:.20;
}

/* Stormy: occasional lightning flash */
.dash-hero .wx-effect.wx-stormy::before{
  content:""; position:absolute; inset:0;
  background: rgba(255,255,255,.0);
  animation: wxFlash 6s steps(1,end) infinite;
  opacity:.0;
}

@keyframes wxSpin { from{ transform: rotate(0); } to{ transform: rotate(360deg); } }
@keyframes wxSlideY { from { transform: translateY(-15px); } to{ transform: translateY(15px);} }
@keyframes wxDrift { 0%,100% { transform: translate(0,0);} 50% { transform: translate(6px,-6px);} }
@keyframes wxFall { from{ background-position: 0 0, 6px -6px, -6px 6px; } to { background-position: 0 24px, 6px 18px, -6px 30px; } }
@keyframes wxFlash { 0%, 85%, 100% { background: rgba(255,255,255,0);} 86%{ background: rgba(255,255,255,.35);} 87%{ background: rgba(255,255,255,0);} 93%{ background: rgba(255,255,255,.2);} 94%{ background: rgba(255,255,255,0);} }

/* Swipe animations (preserved from your original CSS) */
.mini-cal__grid.swipe-left  { animation: swipeLeft .25s ease; }
.mini-cal__grid.swipe-right { animation: swipeRight .25s ease; }
@keyframes swipeLeft  { from { transform: translateX(0) } to { transform: translateX(-12px); opacity:.9 } }
@keyframes swipeRight { from { transform: translateX(0) } to { transform: translateX( 12px); opacity:.9 } }

/* Activity Trend */
.activity-trend-card { padding: 8px 12px; }
.trend-head { display:grid; grid-template-columns: 1fr auto auto; gap:8px; align-items:center; }
.trend-title { font-weight:600; }
.trend-legend { display:flex; gap:12px; align-items:center; }
.legend-dot { display:inline-flex; align-items:center; gap:6px; font-size:12px; color:var(--muted); }
.legend-dot::before { content:''; width:10px; height:10px; border-radius:50%; display:inline-block; }
.legend-dot.dot-updates::before { background: var(--accent-3, #6a5acd); }
.legend-dot.dot-conversations::before { background: var(--accent-2, #1e90ff); }
.legend-dot.dot-triggers::before { background: var(--accent-1, #2ecc71); }
.trend-controls { display:flex; gap:8px; align-items:center; justify-self:end; }
.seg { display:inline-flex; border:1px solid var(--line); border-radius:8px; overflow:hidden; }
.seg-btn { padding:4px 8px; border:none; background:transparent; cursor:pointer; font:inherit; }
.seg-btn[aria-pressed="true"] { background:var(--panel-2); }
.trend-body {position:relative;height: 130px;border-radius: 20px;}
.trend-svg {width:100%;height: 130px;}
.trend-svg .line { fill:none; stroke-width:2.5; }
.trend-svg .line.updates { stroke: var(--accent-3, #6a5acd); }
.trend-svg .line.conversations { stroke: var(--accent-2, #1e90ff); }
.trend-svg .line.triggers { stroke: var(--accent-1, #2ecc71); }
.trend-svg .dot { pointer-events:all; fill:#fff; stroke-width:2; }
.trend-svg .dot.updates { stroke: var(--accent-3, #6a5acd); }
.trend-svg .dot.conversations { stroke: var(--accent-2, #1e90ff); }
.trend-svg .dot.triggers { stroke: var(--accent-1, #2ecc71); }
.trend-svg .gx { stroke: var(--line); opacity: .25; }
.trend-tooltip { position:absolute; transform:translate(-50%,-100%); background:var(--panel); border:1px solid var(--line); padding:6px 8px; border-radius:8px; font-size:12px; pointer-events:none; }

/* Overlay for Activity Highlight */
.trend-overlay {position:absolute;inset:0;display:grid;place-items:center;background: color-mix(in srgb, var(--surface), transparent 25%);backdrop-filter: blur(4px);border-radius: 10px;}
.trend-overlay[hidden] { display:none; }
.overlay-inner { width:80%; background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:16px; }
.grid-3 { display:grid; grid-template-columns: repeat(3, 1fr); gap:12px; }
.hl {border:1px dashed var(--line);border-radius:10px;padding:12px;display:grid;grid-template-areas:
"n n btn"
"l l btn";align-items:center;gap:6px;background: color-mix(in srgb, var(--primary), transparent 93%);}
.hl .n { grid-area: n; font-size:28px; font-variant-numeric: tabular-nums; }
.hl .l {grid-area: l;color: var(--bgblur);font-size:12px;}
.hl .route { grid-area: btn; justify-self:end; border:none; background:transparent; cursor:pointer; }
.hl-updates { background: color-mix(in srgb, var(--accent-3), transparent 93%); }
.hl-conversations { background: color-mix(in srgb, var(--accent-2), transparent 93%); }
.hl-triggers {background: color-mix(in srgb, var(--primary), transparent 93%);}

/* Monitor card */
.mon-head {display:flex;justify-content:space-between;}
.mon-meta {display:grid;grid-template-columns: 1fr auto;gap: 2px 12px;font-size: 11px;}
.mon-meta .mono { color:var(--muted); }
.mon-pills {display:grid;grid-template-columns: repeat(7, 1fr);gap:6px;align-items:end;margin-top: 5px;}
.mon-pill { text-align:center; }
.mon-pill .pill { height: 80px; border-radius: 999px; background: color-mix(in srgb, var(--primary), transparent 85%); border:1px solid var(--line); overflow:hidden; position:relative; }
.mon-pill .pill::after { content:''; position:absolute; inset:auto 0 0 0; height: var(--h, 20%); border-radius: 999px; background: color-mix(in srgb, var(--primary), transparent 40%); }
.mon-pill .pill::before { content:''; position:absolute; inset:4px 4px auto 4px; height:8px; border-radius:999px; background: color-mix(in srgb, #22c55e, transparent calc(100% - (var(--ok,1)*100%))); }
.mon-pill .lbl { margin-top:4px; font-size:11px; color:var(--muted); }

/* Revenue card */
.rev-head { display:flex; align-items:center; justify-content:space-between; }
.rev-svg { width:100%; height:260px; }
.rev.line { fill:none; stroke-width:2.5; }
.rev.line.billed { stroke: #16a34a; }      /* green upward zig */
.rev.line.collected { stroke: #0ea5e9; }   /* blue compare */
.rev-svg .gx { stroke: var(--line); opacity:.25; }

/* === Time & Automations row === */
.cards-2 {display:grid;grid-template-columns: 2fr 1fr 1fr 1fr;gap: 5px;}

/* --- Time card layout --- */
.time-card .time-card-body {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 8px;
  height: 16vh;
}
.time-card .clock-dock {
  height: 0; /* visual docking target, anim uses it for end position */
}
.stopwatch {display:flex;align-items:center;justify-content: space-between;cursor:pointer;user-select:none;height: 100px;}
.sw-analog {width: 100px;height: 100px;background: var(--bg);border-radius: 20px;}
.sw-ring { fill: none; stroke: var(--line); stroke-width: 6; }
.sw-ticks rect { fill: var(--text-muted); opacity:.5; }
.sw-hand rect { fill: var(--primary); }
.sw-hub { fill: var(--primary); }
.sw-digital[hidden]{display:none;}
.sw-analog[hidden]{display:none !important;}
.sw-digital {display:grid;gap: 2px;}
.swRow {position:relative;padding: 2px;border-radius: 15px;border: var(--line);}
.swRow .digits {font-size: 30px;font-variant-numeric: tabular-nums;font-weight: 700;}
.swRow.swHours {padding-right: 40px;}
.swRow .swSec {position:absolute;top: 6px;right: 12px;font-size: 17px;font-variant-numeric: tabular-nums;opacity:.8;}

.time-card-foot{ display:flex; align-items:center; justify-content:space-between; gap: 8px; margin-top: 8px; }
.time-card .sw-controls .btn { margin-right:4px; }

/* --- Weekly average semi donut --- */
.avg-pill { display:grid; justify-items:center; align-content:center; gap: 4px; }
.avg-semi {width: 110px;height: 65px;}
.avg-arc-bg { fill:none; stroke: var(--line); stroke-width: 14; stroke-linecap: round; }
.avg-arc-fg { fill:none; stroke: var(--primary); stroke-width: 14; stroke-linecap: round; }
.avgNum { font-weight: 700; }
.avgLabel, .avg-text {color: var(--text-muted);font-size: 12px;}
.avgLabel{background:var(--bg);border-radius:20px;padding: 2px 4px;cursor: pointer;}
/* --- Floating hover panel (opened by top-bar clock) --- */
.floating-timecard {
  position: fixed;
  top: 96px;
  right: 12px;
  width: 360px;
  z-index: 999;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.floating-timecard .hdr {
  display:flex; align-items:center; justify-content:space-between;
  padding: 6px 10px; border-bottom: 1px solid var(--line); cursor: move;
}
.floating-timecard .hdr .title { font-weight:600; }
.floating-timecard .hdr .x { appearance:none; border:0; background:transparent; font-size:18px; line-height:1; cursor:pointer; }

/* edge stickiness */
.floating-timecard.stick-left  { left: 12px; right: auto; }
.floating-timecard.stick-right { right: 12px; left: auto; }

/* --- Automations carousel --- */
#autoCarouselCard header{justify-content:space-between;display: flex;}
.auto-card .auto-carousel {position:relative;overflow: clip;height: 130px;align-items: flex-start;width: 100%;}
.auto-card .carTrack { display:flex; transition: transform .4s ease; will-change: transform; }
.auto-card .carSlide {flex:0 0 100%;padding: 2px;display:grid;align-content:center;justify-items:center;gap: 0px;}
.auto-card .wf {
  display:flex;
  gap: 8px;
  flex-wrap:wrap;
  padding: 2px;
  width: 100%;
  border: 1px dashed var(--bg);
  border-radius: 12px;
  flex-direction: column;
  align-items: center;
}
.auto-card .wf .node {padding: 0px 5px;border-radius: 10px;background: var(--surface);border:1px solid var(--line);font-size: 12px;}
.auto-card .wf .arrow { opacity:.6; }
.auto-card .carNav {position:absolute;bottom: 0;border:0;background: var(--primary-faded);border-radius: 999px;width: 22px;height: 22px;cursor:pointer;box-shadow:0 1px 8px rgba(0,0,0,.15);}
.auto-card .carNav.left { left: 6px; }
.auto-card .carNav.right {right: 6px;}
.auto-card .carDots { position:absolute; bottom: 6px; left:0; right:0; display:flex; gap:6px; justify-content:center; }
.auto-card .carDots button {width: 6px;height: 6px;border-radius:999px;border:0;background: var(--line);opacity:.7;cursor:pointer;}
.auto-card .carDots button[aria-selected="true"] { background: var(--primary); opacity:1; }
