/* ==================== MACOS LIGHT & DARK THEME TOKENS ==================== */
:root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2f9;
  --wallpaper-1: #dbeafe;
  --wallpaper-2: #ede9fe;
  --wallpaper-3: #cffafe;
  --surface: rgba(255, 255, 255, 0.74);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --surface-solid: #ffffff;
  --sidebar-bg: rgba(246, 248, 253, 0.72);
  --sidebar-text: #334155;
  --sidebar-muted: #64748b;
  --sidebar-hover: rgba(15, 23, 42, 0.06);
  --topbar-bg: rgba(255, 255, 255, 0.68);
  --border: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(15, 23, 42, 0.14);
  --glass-highlight: rgba(255, 255, 255, 0.85);
  --text: #0f172a;
  --muted: #64748b;
  --input-bg: rgba(255, 255, 255, 0.82);
  --table-head: rgba(248, 250, 252, 0.82);
  --table-hover: rgba(37, 99, 235, 0.045);
  --weekend-bg: rgba(15, 23, 42, 0.022);
  --track-bg: rgba(15, 23, 42, 0.08);
  --dock-bg: rgba(255, 255, 255, 0.62);
  --dock-item-bg: rgba(255, 255, 255, 0.88);
  --spotlight: rgba(37, 99, 235, 0.11);

  --primary: #007aff;
  --primary-hover: #0062cc;
  --primary-soft: rgba(0, 122, 255, 0.12);
  --indigo: #5856d6;
  --success: #059669;
  --success-soft: rgba(16, 185, 129, 0.14);
  --warning: #d97706;
  --warning-soft: rgba(245, 158, 11, 0.15);
  --danger: #dc2626;
  --danger-soft: rgba(239, 68, 68, 0.13);
  --muted-badge-bg: rgba(15, 23, 42, 0.07);
  --muted-badge-text: #475569;

  --radius: 16px;
  --ease-mac: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --shadow: 0 2px 6px rgba(15, 23, 42, 0.05), 0 12px 30px rgba(15, 23, 42, 0.06);
  --shadow-hover: 0 14px 36px rgba(0, 122, 255, 0.14), 0 4px 12px rgba(15, 23, 42, 0.07);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0e17;
  --wallpaper-1: #1e3a8a;
  --wallpaper-2: #4c1d95;
  --wallpaper-3: #115e59;
  --surface: rgba(24, 30, 46, 0.68);
  --surface-strong: rgba(30, 38, 58, 0.88);
  --surface-solid: #182032;
  --sidebar-bg: rgba(17, 23, 36, 0.72);
  --sidebar-text: #e2e8f0;
  --sidebar-muted: #94a3b8;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --topbar-bg: rgba(17, 23, 36, 0.68);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.16);
  --glass-highlight: rgba(255, 255, 255, 0.13);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --input-bg: rgba(15, 23, 42, 0.65);
  --table-head: rgba(15, 23, 42, 0.55);
  --table-hover: rgba(96, 165, 250, 0.08);
  --weekend-bg: rgba(255, 255, 255, 0.025);
  --track-bg: rgba(255, 255, 255, 0.1);
  --dock-bg: rgba(24, 30, 46, 0.66);
  --dock-item-bg: rgba(40, 50, 74, 0.85);
  --spotlight: rgba(56, 189, 248, 0.16);

  --primary: #0a84ff;
  --primary-hover: #389cff;
  --primary-soft: rgba(10, 132, 255, 0.2);
  --indigo: #5e5ce6;
  --success: #30d158;
  --success-soft: rgba(48, 209, 88, 0.18);
  --warning: #ffd60a;
  --warning-soft: rgba(255, 214, 10, 0.16);
  --danger: #ff453a;
  --danger-soft: rgba(255, 69, 58, 0.18);
  --muted-badge-bg: rgba(255, 255, 255, 0.1);
  --muted-badge-text: #cbd5e1;

  --shadow: 0 4px 14px rgba(0, 0, 0, 0.32), 0 16px 38px rgba(0, 0, 0, 0.28);
  --shadow-hover: 0 16px 40px rgba(10, 132, 255, 0.22), 0 4px 16px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s var(--ease-mac), color 0.3s ease;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ==================== MACOS AMBIENT WALLPAPER ==================== */
.mac-wallpaper {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: var(--bg);
  transition: background 0.45s var(--ease-mac);
}
.mac-wallpaper .orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(95px);
  opacity: 0.62;
  animation: macFloat 16s ease-in-out infinite alternate;
  transition: background 0.5s ease, opacity 0.5s ease;
}
[data-theme="dark"] .mac-wallpaper .orb { opacity: 0.34; }

.mac-wallpaper .orb-1 {
  width: 560px; height: 560px;
  background: radial-gradient(circle, var(--wallpaper-1), transparent 70%);
  top: -160px; left: -120px;
}
.mac-wallpaper .orb-2 {
  width: 520px; height: 520px;
  background: radial-gradient(circle, var(--wallpaper-2), transparent 70%);
  bottom: -180px; right: -100px;
  animation-delay: -6s;
}
.mac-wallpaper .orb-3 {
  width: 420px; height: 420px;
  background: radial-gradient(circle, var(--wallpaper-3), transparent 70%);
  top: 38%; left: 46%;
  animation-delay: -11s;
}

/* ==================== KEYFRAMES ==================== */
@keyframes macFloat {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(36px, -28px) scale(1.07); }
  100% { transform: translate(-24px, 22px) scale(0.96); }
}

@keyframes macWindowIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-16px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(-10px) scale(0.94); }
}

@keyframes barGrowY {
  from { transform: scaleY(0); opacity: 0.35; }
  to { transform: scaleY(1); opacity: 1; }
}

@keyframes barGrowX {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.anim-enter { animation: fadeSlideUp 0.52s var(--ease-mac) both; }
.stagger-1 { animation-delay: 0.04s; }
.stagger-2 { animation-delay: 0.09s; }
.stagger-3 { animation-delay: 0.14s; }
.stagger-4 { animation-delay: 0.19s; }

/* ==================== MACOS CHROME & THEME SWITCH ==================== */
.mac-glass {
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(185%);
  -webkit-backdrop-filter: blur(24px) saturate(185%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-highlight);
}

.traffic-lights {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.traffic-lights.sm { gap: 6px; }
.tl {
  width: 13px; height: 13px; border-radius: 50%;
  border: none; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.22);
  transition: transform 0.22s var(--ease-spring), filter 0.2s;
  position: relative;
}
.traffic-lights.interactive .tl { cursor: pointer; }
.traffic-lights.sm .tl { width: 12px; height: 12px; }
.tl-glyph {
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  color: rgba(0, 0, 0, 0.62);
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.16s ease, transform 0.18s var(--ease-spring);
  pointer-events: none;
}
.traffic-lights:hover .tl-glyph { opacity: 1; transform: scale(1); }
.tl:hover { transform: scale(1.16); filter: brightness(1.06); }
.tl:active { transform: scale(0.92); }
.tl-red { background: #ff5f57; }
.tl-yellow { background: #febc2e; }
.tl-green { background: #28c840; }

.mac-window-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

/* macOS Segmented Light/Dark Switch */
.theme-switch-btn {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  padding: 3px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--track-bg);
  cursor: pointer;
  user-select: none;
  min-width: 128px;
  transition: background 0.3s ease, border-color 0.3s ease;
}
.theme-switch-btn:active { transform: scale(0.97); }
.theme-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  border-radius: 99px;
  background: var(--surface-solid);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
  transition: transform 0.38s var(--ease-spring), background 0.3s ease;
}
[data-theme="dark"] .theme-thumb {
  transform: translateX(100%);
  background: rgba(255, 255, 255, 0.16);
}
.theme-opt {
  position: relative;
  z-index: 1;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  text-align: center;
  color: var(--muted);
  transition: color 0.25s ease;
}
[data-theme="light"] .theme-opt[data-opt="light"],
[data-theme="dark"] .theme-opt[data-opt="dark"] {
  color: var(--text);
}

/* ==================== LOGIN ==================== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 440px;
  border-radius: 22px;
  padding: 26px 32px 32px;
  animation: macWindowIn 0.6s var(--ease-mac) both;
}
.login-header { text-align: center; margin-bottom: 22px; }
.login-header h1 { font-size: 21px; margin: 12px 0 4px; letter-spacing: -0.025em; }
.login-header p { margin: 0; color: var(--muted); font-size: 13px; }

.brand-badge {
  width: 52px; height: 52px; border-radius: 15px;
  background: linear-gradient(145deg, #007aff, #5856d6);
  color: #fff; font-weight: 700; font-size: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px rgba(0, 122, 255, 0.32), inset 0 1px 0 rgba(255,255,255,0.4);
  transition: transform 0.35s var(--ease-spring);
}
.brand-badge:hover { transform: scale(1.08) rotate(-3deg); }
.brand-badge.sm { width: 38px; height: 38px; font-size: 14px; border-radius: 11px; }

.demo-accounts {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-strong);
}
.demo-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.demo-buttons { display: flex; flex-wrap: wrap; gap: 6px; }

/* ==================== MACOS WINDOW STAGE & GENIE EFFECT ==================== */
@keyframes genieMinimize {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1, 1) skewX(0deg);
    border-radius: 22px;
    filter: blur(0px);
  }
  42% {
    opacity: 0.92;
    transform: translate3d(calc(var(--genie-x, 0px) * 0.35), calc(var(--genie-y, 380px) * 0.42), 0)
      scale(0.54, 0.72) skewX(var(--genie-skew, -6deg));
    border-radius: 36px;
    filter: blur(1px);
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--genie-x, 0px), var(--genie-y, 460px), 0)
      scale(0.05, 0.07) skewX(var(--genie-skew, -12deg));
    border-radius: 50px;
    filter: blur(5px);
  }
}

@keyframes genieRestore {
  0% {
    opacity: 0;
    transform: translate3d(var(--genie-x, 0px), var(--genie-y, 460px), 0)
      scale(0.05, 0.07) skewX(var(--genie-skew, -12deg));
    border-radius: 50px;
    filter: blur(5px);
  }
  58% {
    opacity: 0.96;
    transform: translate3d(calc(var(--genie-x, 0px) * 0.16), calc(var(--genie-y, 380px) * 0.18), 0)
      scale(0.92, 0.97) skewX(calc(var(--genie-skew, -6deg) * 0.25));
    border-radius: 26px;
    filter: blur(0.4px);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1, 1) skewX(0deg);
    filter: blur(0px);
  }
}

@keyframes dockBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-16px) scale(1.18); }
  65% { transform: translateY(-3px) scale(1.04); }
  82% { transform: translateY(-8px) scale(1.08); }
}

@keyframes macWindowOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(22px) scale(0.92); }
}

.mac-desktop-clock {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  z-index: 5;
  animation: fadeSlideUp 0.55s var(--ease-mac) both;
}
.desktop-time {
  font-size: clamp(64px, 11vw, 118px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text);
  opacity: 0.85;
  text-shadow: 0 12px 36px rgba(0, 0, 0, 0.12);
}
.desktop-date {
  margin-top: 10px;
  font-size: 20px;
  font-weight: 500;
  color: var(--muted);
}
.desktop-hint {
  margin-top: 26px;
  font-size: 13px;
  color: var(--muted);
  padding: 7px 16px;
  border-radius: 99px;
  background: var(--surface);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
}

.mac-stage {
  min-height: 100vh;
  padding: 0;
  transition: padding 0.45s var(--ease-mac);
}
.mac-stage.stage-windowed {
  padding: 18px 22px 86px;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 0;
  border: 1px solid transparent;
  transform-origin: center center;
  will-change: transform, opacity, border-radius;
  transition:
    border-radius 0.45s var(--ease-mac),
    box-shadow 0.45s var(--ease-mac),
    border-color 0.35s ease,
    max-width 0.45s var(--ease-mac),
    min-height 0.45s var(--ease-mac);
}
.app-shell.is-windowed {
  max-width: 1460px;
  min-height: calc(100vh - 104px);
  height: calc(100vh - 104px);
  border-radius: 22px;
  border-color: var(--border-strong);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.2), 0 4px 16px rgba(0, 0, 0, 0.08), inset 0 1px 0 var(--glass-highlight);
}
.app-shell.is-windowed .sidebar {
  height: 100%;
}
.app-shell.is-windowed .main-area {
  height: 100%;
  overflow-y: auto;
}
.app-shell.is-windowed .page-content {
  padding-bottom: 36px;
}

.app-shell.genie-minimizing {
  animation: genieMinimize 0.56s cubic-bezier(0.32, 0, 0.18, 1) forwards;
  pointer-events: none;
}
.app-shell.genie-minimized {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.05);
  visibility: hidden;
}
.app-shell.genie-restoring {
  animation: genieRestore 0.58s var(--ease-mac) forwards;
}

.dock-item.bouncing {
  animation: dockBounce 0.56s var(--ease-mac);
}
.modal-backdrop.closing {
  animation: fadeIn 0.22s ease reverse forwards;
}
.modal-backdrop.closing .modal-box {
  animation: macWindowOut 0.24s var(--ease-mac) forwards;
}

.sidebar {
  background: var(--sidebar-bg);
  backdrop-filter: blur(26px) saturate(190%);
  -webkit-backdrop-filter: blur(26px) saturate(190%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--border);
  transition: background 0.4s var(--ease-mac), border-color 0.3s ease;
}
.sidebar-traffic {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 8px 14px;
}
.mac-app-tag {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  opacity: 0.75;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid var(--border);
}
.brand-name { font-weight: 700; font-size: 15px; color: var(--text); letter-spacing: -0.015em; }
.role-pill {
  display: inline-block; margin-top: 2px;
  font-size: 11px; padding: 1px 8px; border-radius: 99px;
  background: var(--primary-soft); color: var(--primary); font-weight: 600;
}

.sidebar-nav {
  position: relative;
  display: flex; flex-direction: column; gap: 5px;
  margin-top: 14px; flex: 1; overflow-y: auto;
  padding: 2px 0;
}
.nav-active-pill {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--indigo));
  box-shadow: 0 8px 22px rgba(0, 122, 255, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transform: translateY(0);
  transition:
    transform 0.42s var(--ease-spring),
    height 0.3s var(--ease-mac),
    opacity 0.25s ease;
}
.nav-item {
  position: relative;
  z-index: 1;
  display: flex; align-items: center; gap: 11px;
  width: 100%; border: none; background: transparent;
  color: var(--sidebar-text); padding: 10px 13px; border-radius: 12px;
  cursor: pointer; text-align: left; font-size: 13.5px; font-weight: 500;
  transition: background 0.22s var(--ease-mac), color 0.22s ease, transform 0.24s var(--ease-spring);
}
.nav-item:hover:not(.active) {
  background: var(--sidebar-hover);
  transform: translateX(4px);
}
.nav-item:active { transform: scale(0.97); }
.nav-item.active {
  color: #fff;
  font-weight: 600;
}
.nav-icon {
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  transition: transform 0.32s var(--ease-spring);
}
.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
  transform: scale(1.22);
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.user-card { padding: 0 8px 10px; }
.user-name { font-weight: 600; color: var(--text); font-size: 13.5px; }
.user-meta { font-size: 12px; color: var(--sidebar-muted); }
.sidebar-actions { display: flex; gap: 6px; }
.sidebar-actions .text-danger { color: var(--danger); }

.main-area { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--topbar-bg);
  backdrop-filter: blur(22px) saturate(185%);
  -webkit-backdrop-filter: blur(22px) saturate(185%);
  border-bottom: 1px solid var(--border);
  padding: 15px 28px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 20;
  transition: background 0.4s var(--ease-mac), border-color 0.3s ease;
}
.topbar h2 { margin: 0; font-size: 19px; letter-spacing: -0.025em; }
.subtitle { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.topbar-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.month-picker { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.month-picker input {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 13px; color: var(--text); background: var(--input-bg);
}

.page-content {
  padding: 24px 28px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ==================== CARDS, KPIs & CURSOR SPOTLIGHT ==================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 16px;
}
.kpi-card,
.subacc-card {
  --mx: 50%;
  --my: 50%;
  position: relative;
  overflow: hidden;
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(175%);
  -webkit-backdrop-filter: blur(20px) saturate(175%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-highlight);
  transition: transform 0.32s var(--ease-mac), box-shadow 0.32s var(--ease-mac), border-color 0.25s, background 0.35s;
}
.kpi-card::before,
.subacc-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(280px circle at var(--mx) var(--my), var(--spotlight), transparent 68%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.kpi-card:hover::before,
.subacc-card:hover::before { opacity: 1; }

.kpi-card { padding: 18px 20px; }
.kpi-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--shadow-hover), inset 0 1px 0 var(--glass-highlight);
  border-color: var(--border-strong);
}
.kpi-label { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.kpi-value { font-size: 25px; font-weight: 700; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 5px; }
.kpi-card.highlight {
  border-color: rgba(0, 122, 255, 0.35);
  background: linear-gradient(145deg, var(--primary-soft) 0%, var(--surface) 72%);
}
.kpi-card.highlight .kpi-value { color: var(--primary); }
.kpi-card.warn .kpi-value { color: var(--warning); }
.kpi-card.success .kpi-value { color: var(--success); }

.card {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(175%);
  -webkit-backdrop-filter: blur(20px) saturate(175%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-highlight);
  overflow: hidden;
  transition: box-shadow 0.3s ease, background 0.35s ease, border-color 0.3s ease;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.card-header h3 { margin: 0; font-size: 15.5px; letter-spacing: -0.015em; }
.card-body { padding: 18px 20px; }

/* ==================== FLOATING MACOS DOCK ==================== */
.mac-dock-wrap {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  pointer-events: none;
}
.mac-dock {
  pointer-events: auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 12px 10px;
  border-radius: 22px;
  background: var(--dock-bg);
  backdrop-filter: blur(26px) saturate(200%);
  -webkit-backdrop-filter: blur(26px) saturate(200%);
  border: 1px solid var(--border-strong);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.18), inset 0 1px 0 var(--glass-highlight);
  transition: background 0.35s ease, border-color 0.35s ease;
}
.dock-item {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--dock-item-bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  cursor: pointer;
  transform-origin: bottom center;
  will-change: transform;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), inset 0 1px 0 var(--glass-highlight);
  transition: transform 0.16s var(--ease-mac), background 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.dock-item.active {
  background: linear-gradient(145deg, var(--primary), var(--indigo));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(0, 122, 255, 0.38);
}
.dock-item.active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
}
.dock-tooltip {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(4px) scale(0.92);
  background: var(--surface-strong);
  color: var(--text);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(14px);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
  transition: opacity 0.16s ease, transform 0.2s var(--ease-mac);
}
.dock-item:hover .dock-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

/* ==================== DASHBOARD CHARTS & SUB-ACCOUNTS ==================== */
.dash-grid-2 {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 20px;
}

.chart-toggle {
  display: inline-flex;
  background: var(--track-bg);
  padding: 3px;
  border-radius: 10px;
  gap: 2px;
}
.chart-toggle button {
  border: none;
  background: transparent;
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.22s var(--ease-mac);
}
.chart-toggle button.active {
  background: var(--surface-solid);
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.bar-chart-wrap { position: relative; padding: 8px 4px 2px; }

/* Vivid Interactive SVG Combo Chart */
.vivid-chart-box {
  position: relative;
  width: 100%;
  user-select: none;
}
.vivid-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}
.vc-grid {
  stroke: var(--border);
  stroke-dasharray: 4 4;
  stroke-width: 1;
}
.vc-axis-lbl {
  fill: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.vc-bar {
  transform-box: fill-box;
  transform-origin: bottom center;
  animation: barGrowY 0.72s var(--ease-mac) both;
  transition: opacity 0.2s ease, filter 0.2s ease;
}
.vc-bar.dimmed { opacity: 0.35; }
.vc-bar.highlighted { filter: brightness(1.18) drop-shadow(0 0 10px rgba(10, 132, 255, 0.45)); }
.vc-bar.salary.highlighted { filter: brightness(1.18) drop-shadow(0 0 10px rgba(48, 209, 88, 0.45)); }

@keyframes lineDraw {
  to { stroke-dashoffset: 0; }
}
@keyframes areaReveal {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes dotPop {
  from { opacity: 0; transform: scale(0); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes sheenSweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(220%); }
}

.vc-area {
  animation: areaReveal 0.8s var(--ease-mac) 0.15s both;
}
.vc-line {
  fill: none;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: lineDraw 1.05s var(--ease-mac) 0.12s forwards;
}
.vc-dot {
  transform-box: fill-box;
  transform-origin: center;
  animation: dotPop 0.45s var(--ease-spring) both;
  transition: r 0.18s var(--ease-spring), filter 0.18s ease;
}
.vc-dot.active {
  filter: drop-shadow(0 0 8px currentColor);
}
.vc-crosshair {
  stroke: var(--primary);
  stroke-width: 1.25;
  stroke-dasharray: 4 3;
  opacity: 0;
  transition: opacity 0.16s ease;
  pointer-events: none;
}
.vc-crosshair.visible { opacity: 0.7; }

.vc-tooltip {
  position: absolute;
  top: 6px;
  left: 0;
  pointer-events: none;
  background: var(--surface-strong);
  color: var(--text);
  backdrop-filter: blur(18px) saturate(190%);
  -webkit-backdrop-filter: blur(18px) saturate(190%);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 9px 13px;
  font-size: 12px;
  line-height: 1.55;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22), inset 0 1px 0 var(--glass-highlight);
  opacity: 0;
  transform: translate(-50%, 6px) scale(0.95);
  transition: opacity 0.16s ease, transform 0.2s var(--ease-mac), left 0.12s var(--ease-mac);
  z-index: 20;
  white-space: nowrap;
}
.vc-tooltip.visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}
.vc-tt-head {
  font-weight: 700;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.vc-tt-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
}
.vc-tt-row strong { color: var(--text); }

/* Shimmer effect on progress & horizontal bars */
.progress-bar,
.hbar-fill {
  position: relative;
  overflow: hidden;
}
.progress-bar::after,
.hbar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 45%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.38), transparent);
  animation: sheenSweep 2.8s ease-in-out infinite;
}

.donut-ring-seg {
  filter: drop-shadow(0 0 8px rgba(10, 132, 255, 0.28));
}
.legend-row.interactive {
  padding: 4px 8px;
  margin: -4px -8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s var(--ease-spring);
}
.legend-row.interactive:hover {
  background: var(--sidebar-hover);
  transform: translateX(3px);
}
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 210px;
  border-bottom: 1px solid var(--border);
  padding: 0 4px;
}
.bar-col {
  flex: 1;
  min-width: 10px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  position: relative;
  cursor: pointer;
}
.bar-fill {
  width: 100%;
  max-width: 24px;
  border-radius: 7px 7px 0 0;
  background: linear-gradient(180deg, #0a84ff 0%, #5e5ce6 100%);
  transform-origin: bottom center;
  animation: barGrowY 0.65s var(--ease-mac) both;
  transition: filter 0.2s ease, transform 0.22s var(--ease-spring);
}
.bar-fill.salary-mode {
  background: linear-gradient(180deg, #30d158 0%, #059669 100%);
}
.bar-fill.zero {
  background: var(--track-bg);
  min-height: 3px;
}
.bar-col:hover .bar-fill:not(.zero) {
  filter: brightness(1.14);
  transform: scaleY(1.05);
}
.bar-label { font-size: 10.5px; color: var(--muted); margin-top: 6px; user-select: none; }
.bar-label.weekend { opacity: 0.65; }
.bar-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: var(--surface-strong);
  color: var(--text);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(14px);
  padding: 8px 11px;
  border-radius: 10px;
  font-size: 11.5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  z-index: 15;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
  transition: opacity 0.18s ease, transform 0.22s var(--ease-mac);
}
.bar-col:hover .bar-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* SVG Donut Ring */
.donut-layout {
  display: flex; align-items: center; justify-content: space-around;
  gap: 18px; flex-wrap: wrap;
}
.donut-svg-wrap { position: relative; width: 156px; height: 156px; flex-shrink: 0; }
.donut-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut-ring-bg { fill: none; stroke: var(--track-bg); stroke-width: 16; }
.donut-ring-seg {
  fill: none; stroke-width: 16; stroke-linecap: round;
  transition: stroke-dashoffset 0.95s var(--ease-mac);
}
.donut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}
.donut-center-val { font-size: 22px; font-weight: 800; color: var(--text); }
.donut-center-lbl { font-size: 11.5px; color: var(--muted); }
.donut-legend { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 160px; }
.legend-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; }
.legend-left { display: flex; align-items: center; gap: 8px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* Sub-accounts Cards Grid */
.subacc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.subacc-card {
  padding: 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.subacc-card:hover {
  transform: translateY(-5px) scale(1.012);
  box-shadow: var(--shadow-hover), inset 0 1px 0 var(--glass-highlight);
  border-color: rgba(0, 122, 255, 0.42);
}
.subacc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.subacc-identity { display: flex; align-items: center; gap: 11px; min-width: 0; }
.avatar-circle {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 5px 14px rgba(0, 122, 255, 0.25), inset 0 1px 0 rgba(255,255,255,0.35);
}
.subacc-name { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subacc-code { font-size: 12px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
.rank-badge {
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 99px;
  background: var(--muted-badge-bg); color: var(--muted-badge-text);
}
.rank-badge.top-1 { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.rank-badge.top-2 { background: rgba(99, 102, 241, 0.2); color: #818cf8; }
.rank-badge.top-3 { background: rgba(16, 185, 129, 0.2); color: #10b981; }

.subacc-metrics {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.subacc-metric-lbl { font-size: 11px; color: var(--muted); }
.subacc-metric-val { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.subacc-metric-val.money { color: var(--primary); }

.progress-block { display: flex; flex-direction: column; gap: 5px; }
.progress-head { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.progress-track { height: 7px; border-radius: 99px; background: var(--track-bg); overflow: hidden; }
.progress-bar {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), var(--indigo));
  transform-origin: left center;
  animation: barGrowX 0.75s var(--ease-mac) both;
}
.subacc-footer { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); }

.hbar-list { display: flex; flex-direction: column; gap: 11px; }
.hbar-item { display: flex; flex-direction: column; gap: 4px; }
.hbar-meta { display: flex; justify-content: space-between; font-size: 13px; }
.hbar-track { height: 8px; background: var(--track-bg); border-radius: 99px; overflow: hidden; }
.hbar-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), #8b5cf6);
  transform-origin: left center;
  animation: barGrowX 0.7s var(--ease-mac) both;
}

/* ==================== FORMS & BUTTONS ==================== */
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--input-bg);
  width: 100%;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.25s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3.5px var(--primary-soft);
}
textarea { min-height: 150px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer;
  transition: background 0.18s ease, transform 0.18s var(--ease-spring), box-shadow 0.22s ease, border-color 0.18s;
}
.btn:active:not(:disabled) { transform: scale(0.95); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--indigo));
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.28), inset 0 1px 0 rgba(255,255,255,0.25);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 8px 20px rgba(0, 122, 255, 0.36);
  transform: translateY(-1px);
}
.btn-outline {
  background: var(--input-bg);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-outline:hover {
  background: var(--surface-solid);
  border-color: var(--primary);
  transform: translateY(-1px);
}
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--sidebar-hover); color: var(--text); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar input[type="text"], .toolbar select { width: auto; min-width: 160px; }

/* ==================== TABLES ==================== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--table-head); font-weight: 600; color: var(--muted); font-size: 12.5px; }
tbody tr { transition: background 0.16s ease; }
tbody tr:hover td { background: var(--table-hover); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-weekend td { background: var(--weekend-bg); }
.row-clickable { cursor: pointer; }
code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--muted-badge-bg);
}

/* ==================== BADGES & ALERTS ==================== */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: var(--muted-badge-bg); color: var(--muted-badge-text); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }

.alert {
  padding: 11px 14px; border-radius: 11px; font-size: 13px;
  border: 1px solid var(--border);
  animation: fadeSlideUp 0.35s var(--ease-mac) both;
}
.alert-danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(239,68,68,0.3); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: rgba(245,158,11,0.3); }
.alert-info { background: var(--primary-soft); color: var(--primary); border-color: rgba(0,122,255,0.28); }
.alert-success { background: var(--success-soft); color: var(--success); border-color: rgba(16,185,129,0.3); }

/* ==================== MACOS ANIMATE OPENING FROM LEFT SIDEBAR TABS ==================== */
@keyframes appOpenZoom {
  0% {
    opacity: 0;
    transform: translate3d(-42px, 0, 0) scale(0.84);
    filter: blur(6px);
  }
  65% {
    opacity: 1;
    filter: blur(0px);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    filter: blur(0px);
  }
}

.app-open-zoom {
  transform-origin: 0% var(--tab-origin-y, 18%);
  animation: appOpenZoom 0.48s var(--ease-mac) both;
}

@keyframes modalZoomOpen {
  0% {
    opacity: 0;
    transform: translate3d(var(--m-dx, 0px), var(--m-dy, 36px), 0) scale(0.26);
    filter: blur(4px);
  }
  70% {
    opacity: 1;
    filter: blur(0px);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    filter: blur(0px);
  }
}

@keyframes modalZoomClose {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    filter: blur(0px);
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--m-dx, 0px), var(--m-dy, 36px), 0) scale(0.24);
    filter: blur(4px);
  }
}

@keyframes launchpadIn {
  from {
    opacity: 0;
    transform: scale(1.12);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: scale(1);
    filter: blur(0px);
  }
}

@keyframes launchpadOut {
  from {
    opacity: 1;
    transform: scale(1);
    filter: blur(0px);
  }
  to {
    opacity: 0;
    transform: scale(1.12);
    filter: blur(10px);
  }
}

.dock-divider {
  width: 1px;
  height: 28px;
  background: var(--border-strong);
  margin: 0 3px 8px;
  align-self: center;
}

/* macOS Launchpad Overlay */
.mac-launchpad {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px 104px;
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(32px) saturate(190%);
  -webkit-backdrop-filter: blur(32px) saturate(190%);
  animation: launchpadIn 0.36s var(--ease-mac) both;
}
[data-theme="light"] .mac-launchpad {
  background: rgba(241, 245, 249, 0.56);
}
.mac-launchpad.closing {
  animation: launchpadOut 0.26s ease forwards;
  pointer-events: none;
}
.launchpad-inner {
  width: 100%;
  max-width: 780px;
  text-align: center;
}
.launchpad-header { margin-bottom: 34px; }
.launchpad-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
}
.launchpad-sub {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}
.launchpad-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
  gap: 26px 20px;
  justify-items: center;
}
.lp-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 6px;
  transition: transform 0.26s var(--ease-spring);
}
.lp-tile:hover { transform: translateY(-6px) scale(1.08); }
.lp-tile:active { transform: scale(0.92); }
.lp-icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #fff;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.42);
  transition: box-shadow 0.25s ease;
}
.lp-tile:hover .lp-icon {
  box-shadow: 0 20px 38px rgba(0, 122, 255, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.lp-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  max-width: 130px;
}

/* ==================== MODAL & MACOS TOAST ==================== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(8, 12, 22, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 1000;
  animation: fadeIn 0.22s ease both;
}
.modal-box {
  border-radius: 18px; width: 100%; max-width: 540px;
  max-height: 90vh; overflow-y: auto;
  background: var(--surface-strong);
  animation: modalZoomOpen 0.4s var(--ease-mac) both;
}
.modal-backdrop.closing .modal-box {
  animation: modalZoomClose 0.26s cubic-bezier(0.32, 0, 0.2, 1) forwards;
}
.modal-header {
  padding: 15px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header-left { display: flex; align-items: center; gap: 12px; }
.modal-header h3 { margin: 0; font-size: 15.5px; }
.icon-btn {
  border: none; background: transparent; font-size: 22px; line-height: 1;
  cursor: pointer; color: var(--muted); padding: 2px 6px; border-radius: 7px;
  transition: background 0.15s, color 0.15s, transform 0.2s var(--ease-spring);
}
.icon-btn:hover { background: var(--sidebar-hover); color: var(--text); transform: rotate(90deg); }
.modal-body { padding: 20px; }

#toast-container {
  position: fixed; top: 18px; right: 18px; z-index: 2000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--surface-strong);
  color: var(--text);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border-strong);
  padding: 11px 16px; border-radius: 13px;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2), inset 0 1px 0 var(--glass-highlight);
  max-width: 360px;
  animation: toastIn 0.38s var(--ease-mac) both;
}
.toast.closing { animation: toastOut 0.28s ease forwards; }
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }

.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.checkbox-row input { width: auto; }
.empty-state { text-align: center; padding: 36px 16px; color: var(--muted); }

/* ==================== AVATARS, PROFILE, FEEDBACK & GLOBAL CHAT ==================== */
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
}

.user-card-flex {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border-radius: 11px;
  padding: 6px 8px;
  margin-bottom: 6px;
  transition: background 0.2s ease;
}
.user-card-flex:hover { background: var(--sidebar-hover); }

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}
.sidebar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 122, 255, 0.25);
}

/* Profile Page */
.profile-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
}
.avatar-upload-box {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px;
  border-radius: 14px;
  background: var(--track-bg);
  border: 1px dashed var(--border-strong);
}
.profile-avatar-lg {
  width: 82px;
  height: 82px;
  border-radius: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(0, 122, 255, 0.26);
}

/* Feedback Split Layout */
.feedback-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  align-items: start;
}
.ticket-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 620px;
  overflow-y: auto;
  padding: 14px;
}
.ticket-item {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: transform 0.2s var(--ease-mac), border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.ticket-item:hover {
  transform: translateX(3px);
  border-color: var(--primary);
}
.ticket-item.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 4px 14px rgba(0, 122, 255, 0.16);
}
.ticket-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ticket-preview {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fb-chat-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 330px;
  min-height: 180px;
  overflow-y: auto;
  padding: 16px;
  background: var(--weekend-bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* Chat Bubbles (Shared by Feedback & Global Chat) */
.chat-msg {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  max-width: 86%;
  animation: fadeSlideUp 0.26s var(--ease-mac) both;
}
.chat-msg.mine {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.chat-msg.system {
  align-self: center;
  max-width: 96%;
}
.chat-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
}
.chat-bubble-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.chat-msg.mine .chat-bubble-wrap { align-items: flex-end; }
.chat-sender-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.chat-bubble {
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}
.chat-msg.mine .chat-bubble {
  background: linear-gradient(135deg, var(--primary), var(--indigo));
  color: #fff;
  border-color: transparent;
}
.chat-msg.system .chat-bubble {
  background: var(--success-soft);
  color: var(--text);
  border-color: rgba(16, 185, 129, 0.35);
  font-size: 12.5px;
  text-align: center;
}

.chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  align-items: center;
}
.chat-input-bar input { flex: 1; }

/* Floating Global Chat FAB & Popup */
.chat-fab {
  position: fixed;
  right: 24px;
  bottom: 22px;
  z-index: 120;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: linear-gradient(135deg, var(--primary), var(--indigo));
  color: #fff;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(0, 122, 255, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.26s var(--ease-spring), box-shadow 0.25s ease;
}
.chat-fab:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 16px 36px rgba(0, 122, 255, 0.48);
}
.chat-fab:active { transform: scale(0.95); }
.chat-fab-icon { font-size: 17px; line-height: 1; }
.chat-unread-badge {
  position: absolute;
  top: -6px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(220, 38, 38, 0.5);
}

.chat-popup {
  position: fixed;
  right: 24px;
  bottom: 78px;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 110px);
  z-index: 130;
  border-radius: 20px;
  background: var(--surface-strong);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  animation: macWindowIn 0.34s var(--ease-mac) both;
}
.chat-popup.closing {
  animation: macWindowOut 0.24s var(--ease-mac) forwards;
  pointer-events: none;
}
.chat-popup-header {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.chat-popup-title-wrap { display: flex; align-items: center; gap: 11px; }
.chat-popup-title { font-weight: 700; font-size: 14.5px; }
.chat-popup-sub { font-size: 11.5px; color: var(--muted); }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

@media (max-width: 1050px) {
  .profile-grid, .feedback-layout { grid-template-columns: 1fr; }
}

@media (max-width: 1050px) {
  .dash-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .page-content { padding: 16px 16px 90px; }
  .topbar { padding: 14px 16px; }
  .mac-dock { gap: 5px; padding: 6px 8px 8px; }
  .dock-item { width: 38px; height: 38px; font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
