/* ==========================================================================
   LIFEOS MODERN GLASSMORPHISM DESIGN SYSTEM - iOS / Safari Optimized
   ========================================================================== */

:root {
  --bg-base: #0a0d14;
  --bg-surface: rgba(18, 24, 38, 0.75);
  --bg-surface-hover: rgba(28, 36, 56, 0.85);
  --bg-card: rgba(22, 30, 48, 0.65);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.3);

  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-cyan: #06b6d4;
  --accent-purple: #a855f7;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);

  /* iOS Safe Area Insets */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-base);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(168, 85, 247, 0.1) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(6, 182, 212, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Global Utilities */
.hidden {
  display: none !important;
}

/* Glassmorphism Classes */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

/* Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

/* Sidebar Backdrop for Mobile */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: rgba(13, 17, 27, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  padding: max(24px, var(--sat)) 20px max(24px, var(--sab)) 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 999;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  padding: 0 8px;
  position: relative;
}

.btn-close-sidebar-mobile {
  display: none;
  margin-left: auto;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-close-sidebar-mobile:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.brand-logo {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.5);
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-text h1 span {
  color: var(--accent-cyan);
}

.badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  width: 100%;
}

.nav-item i {
  width: 18px;
  height: 18px;
}

.nav-item:hover {
  background: var(--bg-surface);
  color: var(--text-main);
  transform: translateX(4px);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.2), rgba(99, 102, 241, 0.05));
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--text-main);
  box-shadow: inset 2px 0 0 var(--accent-primary);
}

.nav-badge {
  margin-left: auto;
  background: var(--accent-primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border-glass);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-primary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.user-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-status {
  font-size: 11px;
  color: var(--accent-green);
  display: flex;
  align-items: center;
  gap: 4px;
}

.user-status::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-green);
}

/* Mobile Top Bar (Hidden on desktop) */
.mobile-top-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: max(14px, var(--sat)) 16px 12px 16px;
  background: rgba(13, 17, 27, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 900;
  margin: -32px -40px 20px -40px;
}

.mobile-menu-btn,
.mobile-action-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.mobile-menu-btn:active,
.mobile-action-btn:active {
  transform: scale(0.92);
  background: rgba(99, 102, 241, 0.25);
  border-color: var(--accent-primary);
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

.mobile-brand strong {
  color: var(--accent-cyan);
}

.mobile-logo {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
}

.mobile-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Mobile Bottom Navigation Bar (Thumb friendly) */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(13, 17, 27, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border-glass);
  padding: 8px 12px max(10px, var(--sab)) 12px;
  z-index: 950;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}

.mobile-nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  flex: 1;
}

.mobile-nav-tab i {
  width: 20px;
  height: 20px;
  stroke-width: 2.2;
}

.mobile-nav-tab.active {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

.mobile-nav-tab:active {
  transform: scale(0.92);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 32px 40px;
  max-width: 1400px;
  margin: 0 auto;
  width: calc(100% - 280px);
  min-height: 100vh;
  min-height: 100dvh;
}

/* Top Header */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  gap: 20px;
}

.greeting-section h2 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.greeting-section p {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  width: 340px;
  transition: var(--transition);
}

.search-bar:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.2);
}

.search-bar input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  width: 100%;
  outline: none;
}

.search-bar i {
  color: var(--text-dim);
  width: 16px;
  height: 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #4338ca);
  color: white;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #3730a3);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.btn-secondary {
  background: var(--bg-surface);
  border-color: var(--border-glass);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.btn-danger:hover {
  background: var(--accent-red);
  color: white;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-large {
  padding: 14px 28px;
  font-size: 16px;
  border-radius: var(--radius-lg);
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

/* Tab Switching */
.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.tab-pane.active {
  display: block;
}

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

/* Stat Cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
}

.glow-cyan .stat-icon { color: var(--accent-cyan); background: rgba(6, 182, 212, 0.15); }
.glow-purple .stat-icon { color: var(--accent-purple); background: rgba(168, 85, 247, 0.15); }
.glow-green .stat-icon { color: var(--accent-green); background: rgba(16, 185, 129, 0.15); }
.glow-amber .stat-icon { color: var(--accent-amber); background: rgba(245, 158, 11, 0.15); }

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 2px 0;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-dim);
}

.progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}

.progress-fill {
  height: 100%;
  background: var(--accent-cyan);
  border-radius: 999px;
  transition: width 0.5s ease-out;
}

.progress-fill.purple { background: var(--accent-purple); }
.progress-fill.green { background: var(--accent-green); }
.progress-fill.amber { background: var(--accent-amber); }

/* Grid 2 Column */
.grid-2-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

@media (max-width: 1024px) {
  .grid-2-col {
    grid-template-columns: 1fr;
  }
}

.section-card {
  margin-bottom: 24px;
}

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

.section-header h3 {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Tasks */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  transition: var(--transition);
}

.task-item:hover {
  background: var(--bg-surface-hover);
  transform: translateX(4px);
}

.task-item.completed .task-title {
  text-decoration: line-through;
  color: var(--text-dim);
}

.task-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.task-checkbox.checked {
  background: var(--accent-primary);
  color: white;
}

.task-info {
  flex: 1;
}

.task-title {
  font-size: 14px;
  font-weight: 600;
}

.task-meta-tags {
  display: flex;
  gap: 8px;
  font-size: 11px;
  margin-top: 4px;
}

.tag-pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 11px;
}

.tag-red { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.tag-blue { background: rgba(99, 102, 241, 0.15); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.3); }
.tag-amber { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.tag-green { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }

/* Habit Quick Grid */
.habit-quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.habit-quick-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.habit-quick-card.done {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.08);
}

/* Mood & Journal */
.mood-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.mood-btn {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.mood-btn.active, .mood-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
  color: var(--text-main);
}

.modern-textarea {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 12px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  outline: none;
}

.modern-textarea:focus {
  border-color: var(--accent-primary);
}

/* Kanban Matrix */
.kanban-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.kanban-col {
  display: flex;
  flex-direction: column;
  min-height: 550px;
  background: rgba(18, 24, 38, 0.5);
}

.kanban-col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-glass);
}

.col-count {
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 999px;
}

.kanban-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

/* Habit Matrix Table */
.table-responsive {
  overflow-x: auto;
}

.habit-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.habit-table th, .habit-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-glass);
}

.habit-table th {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.day-col {
  text-align: center;
  width: 50px;
}

.check-bubble {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border-glass);
  background: transparent;
  cursor: pointer;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.check-bubble.active {
  background: var(--accent-green);
  border-color: var(--accent-green);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
  color: white;
}

/* Finance Overview */
.finance-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.fin-grid-4 {
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 1024px) {
  .fin-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .fin-grid-4 {
    grid-template-columns: 1fr;
  }
}

.fin-card {
  padding: 18px 20px;
  border-radius: var(--radius-lg);
}

.fin-income { border-left: 4px solid var(--accent-green); }
.fin-expense { border-left: 4px solid var(--accent-red); }
.fin-net { border-left: 4px solid var(--accent-cyan); }
.fin-networth {
  border-left: 4px solid #6366f1;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(6, 182, 212, 0.1));
}
.fin-assets {
  border-left: 4px solid #10b981;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(15, 23, 42, 0.8));
}
.fin-debts {
  border-left: 4px solid #ef4444;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(15, 23, 42, 0.8));
}

.fin-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.fin-card h3 {
  font-size: 24px;
  font-weight: 800;
  margin-top: 6px;
  margin-bottom: 2px;
}

/* Accounts / Wallets Grid */
.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.account-card {
  padding: 14px 16px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account-card:hover {
  background: rgba(30, 41, 69, 0.8);
  border-color: #6366f1;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.account-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.account-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13.5px;
  color: #fff;
}

.account-type-badge {
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.account-balance {
  font-size: 17px;
  font-weight: 800;
  color: var(--accent-green);
  font-family: var(--font-mono);
}

.account-actions-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-acc-action {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid var(--border-glass);
  cursor: pointer;
  transition: var(--transition);
}

.btn-acc-deduct {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-acc-deduct:hover {
  background: rgba(239, 68, 68, 0.35);
  border-color: #ef4444;
  color: #fff;
  transform: translateY(-1px);
}

.btn-acc-add {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.3);
}

.btn-acc-add:hover {
  background: rgba(16, 185, 129, 0.35);
  border-color: #10b981;
  color: #fff;
  transform: translateY(-1px);
}

.btn-acc-edit {
  flex: 0 0 28px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.btn-acc-edit:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-success:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.45);
}

/* Modal Transaction Type Toggle (Cộng / Trừ) */
.fin-type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(15, 23, 42, 0.8);
  padding: 5px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.fin-type-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.fin-type-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.fin-type-btn.btn-income.active {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.25);
}

.fin-type-btn.btn-expense.active {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.25);
}

/* Debts List */
.debts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.debt-card {
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-glass);
  border-left: 3px solid #ef4444;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
  cursor: pointer;
}

.debt-card:hover {
  background: rgba(30, 41, 69, 0.8);
  border-color: #ef4444;
}

.debt-info h4 {
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.debt-info p {
  font-size: 11px;
  color: var(--text-dim);
}

.debt-amount {
  font-size: 15px;
  font-weight: 800;
  color: #ef4444;
  font-family: var(--font-mono);
}

/* Receivables List (Tiền người khác nợ mình) */
.receivables-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.receivable-card {
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-glass);
  border-left: 3px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
  cursor: pointer;
}

.receivable-card:hover {
  background: rgba(30, 41, 69, 0.8);
  border-color: var(--accent-cyan);
}

.receivable-info h4 {
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.receivable-info p {
  font-size: 11px;
  color: var(--text-dim);
}

.receivable-amount {
  font-size: 15px;
  font-weight: 800;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.receivable-tag-badge {
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(6, 182, 212, 0.15);
  color: #67e8f9;
  border: 1px solid rgba(6, 182, 212, 0.3);
  font-weight: 700;
}

/* Currency Switcher */
.currency-switcher-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 14, 23, 0.7);
  padding: 4px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.currency-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.currency-label i {
  width: 14px;
  height: 14px;
  color: var(--accent-cyan);
}

.currency-pills {
  display: flex;
  gap: 4px;
}

.currency-pill {
  padding: 4px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.currency-pill:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.currency-pill.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.transaction-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 400px;
  overflow-y: auto;
}

.transaction-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

/* Second Brain / Notes */
.notes-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  width: 100%;
}

.notes-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  width: 100%;
}

.notes-search {
  min-width: 0;
  width: 100%;
}

.notes-search input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-main);
  outline: none;
}

.notes-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.tag-badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}

.tag-badge.active, .tag-badge:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.notes-item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.note-card-item {
  padding: 12px 14px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  cursor: pointer;
  transition: var(--transition);
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.note-card-item:hover, .note-card-item.active {
  background: var(--bg-surface-hover);
  border-color: var(--accent-primary);
}

.note-card-item h4 {
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-card-item p {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.notes-editor-view {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
  width: 100%;
}

.note-title-input {
  font-size: 18px;
  font-weight: 800;
  background: transparent;
  border: none;
  color: var(--text-main);
  outline: none;
  min-width: 0;
  flex: 1;
}

.editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.note-content-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.6;
  outline: none;
  resize: vertical;
}

/* Deep Focus Timer */
.focus-container {
  max-width: 600px;
  margin: 40px auto;
  text-align: center;
  padding: 48px 32px;
}

.focus-modes {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 40px;
}

.focus-mode-btn {
  padding: 8px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.focus-mode-btn.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.4);
}

.timer-circle-wrapper {
  margin-bottom: 36px;
}

.timer-display {
  font-family: var(--font-mono);
  font-size: 72px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--text-main);
  text-shadow: 0 0 30px rgba(99, 102, 241, 0.4);
}

.timer-status {
  color: var(--text-muted);
  font-size: 15px;
  margin-top: 8px;
}

.timer-controls {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.sound-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

.sound-chip {
  padding: 6px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
}

.sound-chip.active {
  background: rgba(6, 182, 212, 0.2);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.hidden {
  display: none;
}

.modal-content {
  width: 100%;
  max-width: 520px;
  animation: scaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input, .modern-select {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

.form-group input:focus, .modern-select:focus {
  border-color: var(--accent-primary);
}

.type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-toggle {
  padding: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 700;
  cursor: pointer;
}

.btn-toggle.active[data-type="expense"] {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: var(--accent-red);
}

.btn-toggle.active[data-type="income"] {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-color: var(--accent-green);
}

/* Lock Screen */
.lock-screen {
  position: fixed;
  inset: 0;
  background: rgba(10, 13, 20, 0.95);
  backdrop-filter: blur(25px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.lock-screen.hidden {
  display: none;
}

.lock-box {
  width: 360px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lock-icon {
  width: 56px;
  height: 56px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.pin-display {
  display: flex;
  gap: 14px;
  margin: 24px 0;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--accent-primary);
  transition: var(--transition);
}

.pin-dot.filled {
  background: var(--accent-primary);
  box-shadow: 0 0 12px var(--accent-primary);
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
}

.pin-btn {
  height: 54px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin-btn:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.lock-footer {
  margin-top: 20px;
  color: var(--text-dim);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 3000;
}

.toast {
  padding: 12px 20px;
  background: rgba(18, 24, 38, 0.95);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-main);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   MINDMAP ENGINE (MINDMEISTER ARCHITECTURE)
   ========================================================================== */

.visual-workspace-card {
  position: relative;
  background: linear-gradient(135deg, rgba(18, 24, 38, 0.85), rgba(12, 17, 29, 0.95));
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.6), 0 0 35px rgba(99, 102, 241, 0.15);
  margin-bottom: 24px;
  overflow: hidden;
}

.visual-main-header {
  flex-wrap: wrap;
  gap: 16px;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 16px;
  margin-bottom: 16px;
}

.visual-title-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.visual-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.visual-icon-pulse {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.6);
  flex-shrink: 0;
  animation: pulseGlow 3s infinite ease-in-out;
}

.visual-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.visual-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* View Mode Switcher */
.view-mode-toggles {
  display: flex;
  background: rgba(10, 14, 23, 0.8);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  gap: 4px;
}

.view-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.view-toggle-btn i {
  width: 14px;
  height: 14px;
}

.view-toggle-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.view-toggle-btn.active {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
  color: white;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.4);
}

/* Mindmap Zoom Bar */
.mindmap-zoom-bar {
  display: flex;
  align-items: center;
  background: rgba(10, 14, 23, 0.8);
  padding: 4px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  gap: 6px;
}

.zoom-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.zoom-btn i {
  width: 15px;
  height: 15px;
}

.zoom-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.zoom-level {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  min-width: 42px;
  text-align: center;
}

/* Mindmap Arena Canvas */
.mindmap-arena-wrapper {
  position: relative;
  width: 100%;
  height: 520px;
  background-color: #0b0f19;
  background-image: 
    radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    radial-gradient(rgba(99, 102, 241, 0.08) 1px, transparent 1px);
  background-size: 28px 28px, 56px 56px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  user-select: none;
  cursor: grab;
}

.mindmap-arena-wrapper:active {
  cursor: grabbing;
}

.mindmap-full-height {
  height: calc(100vh - 220px);
  min-height: 600px;
}

.mindmap-canvas {
  position: absolute;
  width: 3600px;
  height: 3200px;
  top: 0;
  left: 0;
  transform-origin: center center;
  will-change: transform;
}

.mindmap-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.mindmap-nodes-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

/* Mindmap Mini Guide */
.mindmap-mini-guide {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-muted);
  z-index: 10;
  pointer-events: none;
}

.mindmap-mini-guide kbd {
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-weight: 700;
  margin-right: 4px;
}

/* Mindmap Node Hierarchy */
.mindmap-tree-wrapper {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Root Hub Node */
.mm-root-node {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(30, 41, 69, 0.9), rgba(15, 23, 42, 0.95));
  border: 2px solid #6366f1;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 35px rgba(99, 102, 241, 0.4), inset 0 0 20px rgba(99, 102, 241, 0.2);
  padding: 16px 24px;
  border-radius: var(--radius-xl);
  color: white;
  cursor: pointer;
  transition: var(--transition);
  z-index: 5;
}

.mm-root-node:hover {
  transform: scale(1.04);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.7), 0 0 45px rgba(99, 102, 241, 0.6);
  border-color: #818cf8;
}

.mm-root-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.6);
}

.mm-root-text h3 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.mm-root-text span {
  font-size: 11px;
  color: var(--accent-cyan);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Branch Categories (MindMeister Main Topics) */
.mm-branch-node {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  cursor: pointer;
  transition: var(--transition);
  z-index: 4;
}

.mm-branch-node.branch-teaching {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.35), rgba(99, 102, 241, 0.25) 70%, rgba(15, 23, 42, 0.95));
  border: 1.5px solid rgba(168, 85, 247, 0.6);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 20px rgba(168, 85, 247, 0.3);
}

.mm-branch-node.branch-teaching:hover {
  border-color: #c084fc;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.5), 0 0 30px rgba(168, 85, 247, 0.5);
  transform: translateY(-2px);
}

.mm-branch-node.branch-dev {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.35), rgba(16, 185, 129, 0.25) 70%, rgba(15, 23, 42, 0.95));
  border: 1.5px solid rgba(6, 182, 212, 0.6);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 20px rgba(6, 182, 212, 0.3);
}

.mm-branch-node.branch-dev:hover {
  border-color: #38bdf8;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.5), 0 0 30px rgba(6, 182, 212, 0.5);
  transform: translateY(-2px);
}

.mm-branch-node.branch-productivity {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.35), rgba(239, 68, 68, 0.25) 70%, rgba(15, 23, 42, 0.95));
  border: 1.5px solid rgba(245, 158, 11, 0.6);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 20px rgba(245, 158, 11, 0.3);
}

.mm-branch-node.branch-finance {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.35), rgba(6, 182, 212, 0.25) 70%, rgba(15, 23, 42, 0.95));
  border: 1.5px solid rgba(16, 185, 129, 0.6);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 20px rgba(16, 185, 129, 0.3);
}

.mm-branch-node.branch-gaming {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.35), rgba(6, 182, 212, 0.3) 70%, rgba(15, 23, 42, 0.95));
  border: 1.5px solid rgba(236, 72, 153, 0.7);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 22px rgba(236, 72, 153, 0.4);
}

.mm-branch-node.branch-gaming:hover {
  border-color: #f472b6;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.5), 0 0 30px rgba(236, 72, 153, 0.6);
  transform: translateY(-2px);
}

.mm-branch-icon {
  font-size: 18px;
}

.mm-branch-title {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
}

.mm-branch-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.4);
  color: var(--accent-cyan);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Branch Fold/Unfold Toggle (MindMeister +/-) */
.mm-branch-toggle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.mm-branch-toggle:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  transform: scale(1.15);
}

/* Add Child (+) button on branch */
.mm-add-child-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.25);
  border: 1px solid rgba(99, 102, 241, 0.5);
  color: #a5b4fc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.mm-add-child-btn:hover {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 0 10px var(--accent-primary);
  transform: scale(1.15);
}

/* =========================================================================
   ONGOING PROJECT HUBS & MILESTONES (MindMeister Ongoing Project Nodes)
   ========================================================================= */
.mm-project-card {
  position: absolute;
  display: flex;
  flex-direction: column;
  background: rgba(18, 24, 40, 0.95);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  min-width: 320px;
  max-width: 360px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(99, 102, 241, 0.15);
  transition: var(--transition);
  z-index: 3;
}

.mm-project-card:hover {
  border-color: rgba(99, 102, 241, 0.7);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.6), 0 0 28px rgba(99, 102, 241, 0.35);
  transform: translateY(-2px);
}

.mm-project-card.project-teaching {
  border-left: 4px solid #a855f7;
}

.mm-project-card.project-dev {
  border-left: 4px solid #06b6d4;
}

.mm-project-card.project-system {
  border-left: 4px solid #f59e0b;
}

.mm-project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.mm-project-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.mm-project-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.mm-project-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.mm-project-status-badge {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.mm-project-status-badge .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 6px #34d399;
}

/* Progress bar */
.mm-project-progress-box {
  margin: 6px 0 10px 0;
}

.mm-progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.mm-progress-info .pct {
  font-weight: 700;
  color: var(--accent-cyan);
}

.mm-progress-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.mm-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #06b6d4, #a855f7);
  border-radius: 999px;
  transition: width 0.4s ease;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

/* Milestones / Sub-actions list */
.mm-milestones-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.mm-milestone-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: #cbd5e1;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  transition: background 0.2s;
}

.mm-milestone-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.mm-milestone-check {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  cursor: pointer;
  flex-shrink: 0;
  color: white;
  transition: var(--transition);
}

.mm-milestone-check.done {
  background: var(--accent-green);
  border-color: var(--accent-green);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.mm-milestone-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mm-milestone-item.done .mm-milestone-title {
  text-decoration: line-through;
  color: var(--text-dim);
}

.mm-project-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 6px;
}

.mm-project-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.mm-add-ms-btn {
  font-size: 11px;
  color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: var(--transition);
}

.mm-add-ms-btn:hover {
  background: var(--accent-primary);
  color: white;
}

.mm-action-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.mm-action-btn i {
  width: 13px;
  height: 13px;
}

.mm-action-btn:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

/* SVG Connection Paths */
.mm-conn-path {
  fill: none;
  stroke-linecap: round;
  transition: stroke 0.3s, stroke-width 0.3s;
}

.path-teaching {
  stroke: rgba(168, 85, 247, 0.65);
  stroke-width: 2.5px;
  filter: drop-shadow(0 0 5px rgba(168, 85, 247, 0.4));
}

.path-dev {
  stroke: rgba(6, 182, 212, 0.65);
  stroke-width: 2.5px;
  filter: drop-shadow(0 0 5px rgba(6, 182, 212, 0.4));
}

.path-productivity {
  stroke: rgba(245, 158, 11, 0.65);
  stroke-width: 2.5px;
  filter: drop-shadow(0 0 5px rgba(245, 158, 11, 0.4));
}

.path-finance {
  stroke: rgba(16, 185, 129, 0.65);
  stroke-width: 2.5px;
  filter: drop-shadow(0 0 5px rgba(16, 185, 129, 0.4));
}

.path-gaming {
  stroke: rgba(236, 72, 153, 0.75);
  stroke-width: 2.5px;
  filter: drop-shadow(0 0 7px rgba(236, 72, 153, 0.5));
}

.path-subtask {
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 1.8px;
  stroke-dasharray: 4 2;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .mindmap-arena-wrapper {
    height: 420px;
  }
  .mindmap-mini-guide {
    display: none;
  }
}


/* ==========================================================================
   TASK BUBBLE UNIVERSE & RADAR VIEW
   ========================================================================== */

.bubble-radar-card {
  position: relative;
  background: linear-gradient(135deg, rgba(22, 30, 48, 0.8), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(6, 182, 212, 0.25);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 35px rgba(6, 182, 212, 0.12);
  margin-bottom: 24px;
  overflow: visible;
}

.bubble-main-header {
  flex-wrap: wrap;
  gap: 16px;
}

.bubble-title-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.bubble-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.bubble-icon-pulse {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-primary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.5);
  flex-shrink: 0;
  animation: pulseGlow 3s infinite ease-in-out;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); box-shadow: 0 0 18px rgba(6, 182, 212, 0.5); }
  50% { transform: scale(1.05); box-shadow: 0 0 28px rgba(99, 102, 241, 0.7); }
}

.bubble-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background-color: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 10px #34d399;
  animation: blinkDot 1.4s infinite ease-in-out;
}

@keyframes blinkDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

.bubble-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.bubble-filter-pills {
  display: flex;
  align-items: center;
  background: rgba(10, 14, 23, 0.7);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  gap: 4px;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.filter-pill:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.filter-pill.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(6, 182, 212, 0.3));
  color: #ffffff;
  border: 1px solid rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
}

/* Arena Wrapper */
.bubble-arena-wrapper {
  position: relative;
  margin-top: 18px;
  background: radial-gradient(circle at 50% 50%, rgba(30, 41, 69, 0.5) 0%, rgba(10, 13, 20, 0.8) 100%);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 24px 16px;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.bubble-arena-wrapper::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: 
    radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    radial-gradient(rgba(99, 102, 241, 0.05) 1px, transparent 1px);
  background-size: 24px 24px, 48px 48px;
  pointer-events: none;
}

.bubble-arena {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 22px;
  width: 100%;
  max-width: 1100px;
  padding: 10px;
  z-index: 2;
}

/* Individual Task Bubble */
.task-bubble {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  user-select: none;
  text-align: center;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s, border-color 0.35s;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.task-bubble.size-lg {
  width: 175px;
  height: 175px;
  padding: 18px;
}

.task-bubble.size-md {
  width: 150px;
  height: 150px;
  padding: 14px;
}

.task-bubble.size-sm {
  width: 130px;
  height: 130px;
  padding: 12px;
}

/* Floating Animations */
.float-anim-1 { animation: floatBubble1 7s infinite ease-in-out; }
.float-anim-2 { animation: floatBubble2 8.5s infinite ease-in-out 1s; }
.float-anim-3 { animation: floatBubble3 6.5s infinite ease-in-out 2s; }
.float-anim-4 { animation: floatBubble4 9s infinite ease-in-out 0.5s; }

@keyframes floatBubble1 {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(1.5deg); }
}

@keyframes floatBubble2 {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(14px) rotate(-1.5deg); }
}

@keyframes floatBubble3 {
  0%, 100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-15px) scale(1.02); }
}

@keyframes floatBubble4 {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(10px) rotate(1deg); }
}

.task-bubble:hover {
  transform: translateY(-8px) scale(1.1) !important;
  z-index: 30;
  animation-play-state: paused;
}

/* Bubble Categories & Themes */
.bubble-theme-teaching {
  background: radial-gradient(circle at 35% 35%, rgba(168, 85, 247, 0.4), rgba(99, 102, 241, 0.25) 70%, rgba(15, 23, 42, 0.85) 100%);
  border: 1.5px solid rgba(168, 85, 247, 0.6);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45), 0 0 25px rgba(168, 85, 247, 0.3), inset 0 0 15px rgba(255, 255, 255, 0.15);
}

.bubble-theme-teaching:hover {
  border-color: #c084fc;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.6), 0 0 40px rgba(168, 85, 247, 0.6), inset 0 0 25px rgba(255, 255, 255, 0.25);
}

.bubble-theme-dev {
  background: radial-gradient(circle at 35% 35%, rgba(6, 182, 212, 0.4), rgba(16, 185, 129, 0.25) 70%, rgba(15, 23, 42, 0.85) 100%);
  border: 1.5px solid rgba(6, 182, 212, 0.6);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45), 0 0 25px rgba(6, 182, 212, 0.3), inset 0 0 15px rgba(255, 255, 255, 0.15);
}

.bubble-theme-dev:hover {
  border-color: #38bdf8;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.6), 0 0 40px rgba(6, 182, 212, 0.6), inset 0 0 25px rgba(255, 255, 255, 0.25);
}

.bubble-theme-urgent {
  background: radial-gradient(circle at 35% 35%, rgba(239, 68, 68, 0.4), rgba(245, 158, 11, 0.25) 70%, rgba(15, 23, 42, 0.85) 100%);
  border: 1.5px solid rgba(239, 68, 68, 0.6);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45), 0 0 25px rgba(239, 68, 68, 0.3), inset 0 0 15px rgba(255, 255, 255, 0.15);
}

.bubble-theme-urgent:hover {
  border-color: #f87171;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.6), 0 0 40px rgba(239, 68, 68, 0.6), inset 0 0 25px rgba(255, 255, 255, 0.25);
}

.bubble-theme-default {
  background: radial-gradient(circle at 35% 35%, rgba(99, 102, 241, 0.35), rgba(30, 41, 59, 0.5) 70%, rgba(15, 23, 42, 0.85) 100%);
  border: 1.5px solid rgba(99, 102, 241, 0.5);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45), 0 0 20px rgba(99, 102, 241, 0.25), inset 0 0 15px rgba(255, 255, 255, 0.1);
}

.bubble-theme-default:hover {
  border-color: #818cf8;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.6), 0 0 35px rgba(99, 102, 241, 0.5), inset 0 0 25px rgba(255, 255, 255, 0.2);
}

/* Pulsing outer ring for high-priority */
.bubble-pulse-ring::after {
  content: '';
  position: absolute;
  top: -8px; left: -8px; right: -8px; bottom: -8px;
  border-radius: 50%;
  border: 1.5px dashed rgba(239, 68, 68, 0.5);
  animation: rotateRing 14s linear infinite;
  pointer-events: none;
}

@keyframes rotateRing {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Bubble Content Elements */
.bubble-top-icon {
  font-size: 26px;
  margin-bottom: 6px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

.bubble-label {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
  padding: 0 4px;
}

.size-lg .bubble-label {
  font-size: 14px;
}

.bubble-sub-tag {
  margin-top: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
}

.bubble-urgency-badge {
  position: absolute;
  top: 4px;
  right: 14px;
  font-size: 11px;
}

/* Popover details */
.bubble-detail-popover {
  position: absolute;
  z-index: 250;
  width: 290px;
  background: rgba(18, 24, 38, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(99, 102, 241, 0.3);
  animation: popoverFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: top center;
}

.bubble-detail-popover.hidden {
  display: none !important;
}

@keyframes popoverFadeIn {
  from { opacity: 0; transform: scale(0.9) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.popover-tag {
  font-size: 11px;
  font-weight: 700;
  color: #f87171;
  background: rgba(239, 68, 68, 0.15);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.popover-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: var(--transition);
}

.popover-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.popover-title {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 10px;
  line-height: 1.4;
}

.popover-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-glass);
}

.popover-meta span {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.popover-meta i {
  width: 14px;
  height: 14px;
  color: var(--accent-cyan);
}

.popover-actions {
  display: flex;
  gap: 8px;
}

.popover-actions .btn {
  flex: 1;
  justify-content: center;
  font-size: 12px;
  padding: 8px 10px;
}

.popover-actions .btn-secondary {
  flex: 0 0 38px;
  padding: 8px;
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
  transform: translateY(-1px);
}

/* Empty state in bubble arena */
.bubble-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 30px;
  text-align: center;
  color: var(--text-muted);
}

.bubble-empty-icon {
  font-size: 42px;
  animation: floatBubble1 4s infinite ease-in-out;
}

/* Particle explosion */
.particle-spark {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 999;
  animation: particleBurst 0.7s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes particleBurst {
  0% { transform: translate(0, 0) scale(1.2); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

/* ==========================================================================
   GOOGLE-STYLE CALENDAR & PLANNING SYSTEM
   ========================================================================== */

.cal-main-header {
  flex-wrap: wrap;
  gap: 16px;
}

.cal-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cal-title-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cal-logo-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
  flex-shrink: 0;
}

.cal-header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.cal-nav-group {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(10, 14, 23, 0.7);
  padding: 4px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.cal-arrows {
  display: flex;
  gap: 4px;
}

.cal-current-label {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  min-width: 130px;
  margin: 0 4px;
}

.cal-workspace-card {
  padding: 0;
  overflow: hidden;
  min-height: 680px;
  display: flex;
  flex-direction: column;
}

/* 1. MONTH VIEW */
.cal-month-view {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.cal-weekdays-header {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid var(--border-glass);
}

.cal-weekdays-header > div {
  padding: 12px 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.cal-weekdays-header > div:last-child {
  border-right: none;
}

.cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(115px, 1fr);
  flex: 1;
  background: rgba(11, 15, 25, 0.6);
}

.cal-day-cell {
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  transition: background 0.15s ease;
  cursor: pointer;
  min-width: 0;
  overflow: hidden;
}

.cal-day-cell:nth-child(7n) {
  border-right: none;
}

.cal-day-cell:hover {
  background: rgba(255, 255, 255, 0.03);
}

.cal-day-cell.other-month {
  opacity: 0.35;
  background: rgba(0, 0, 0, 0.2);
}

.cal-day-top {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 2px;
}

.cal-day-num {
  font-size: 12px;
  font-weight: 700;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-muted);
}

.cal-day-cell.is-today .cal-day-num {
  background: #3b82f6;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.8);
}

/* Event chips inside month cell */
.cal-day-events {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  max-height: 90px;
  min-width: 0;
  width: 100%;
}

.cal-event-chip {
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.cal-event-chip:hover {
  transform: translateY(-1px);
  filter: brightness(1.15);
}

.cal-chip-time {
  font-size: 10px;
  opacity: 0.85;
  font-family: var(--font-mono);
  flex-shrink: 0;
  font-weight: 700;
}

.cal-chip-title,
.cal-event-chip span:not(.cal-chip-time) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
  display: block;
}

.cal-event-chip.cat-teaching {
  background: rgba(168, 85, 247, 0.25);
  border: 1px solid rgba(168, 85, 247, 0.5);
  color: #d8b4fe;
}

.cal-event-chip.cat-dev {
  background: rgba(59, 130, 246, 0.25);
  border: 1px solid rgba(59, 130, 246, 0.5);
  color: #93c5fd;
}

.cal-event-chip.cat-system {
  background: rgba(245, 158, 11, 0.25);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fcd34d;
}

.cal-event-chip.cat-finance {
  background: rgba(16, 185, 129, 0.25);
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #6ee7b7;
}

.cal-event-chip.cat-personal {
  background: rgba(236, 72, 153, 0.25);
  border: 1px solid rgba(236, 72, 153, 0.5);
  color: #f472b6;
}

.cal-event-chip.cat-urgent {
  background: rgba(239, 68, 68, 0.3);
  border: 1px solid rgba(239, 68, 68, 0.6);
  color: #fca5a5;
  font-weight: 700;
}

/* 2. WEEK VIEW */
.cal-week-view {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.cal-week-header {
  display: grid;
  grid-template-columns: 60px repeat(7, minmax(0, 1fr));
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid var(--border-glass);
}

.cal-week-header-day {
  padding: 10px 4px;
  text-align: center;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.cal-week-header-day .day-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.cal-week-header-day .day-number {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  margin-top: 2px;
}

.cal-week-header-day.is-today .day-number {
  color: #3b82f6;
  text-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
}

.cal-week-body {
  display: grid;
  grid-template-columns: 60px 1fr;
  flex: 1;
  max-height: calc(100vh - 240px);
  min-height: 560px;
  overflow-y: auto;
  position: relative;
  scroll-behavior: smooth;
}

.cal-time-column {
  display: flex;
  flex-direction: column;
  background: rgba(10, 14, 23, 0.95);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.cal-time-slot {
  height: 48px;
  padding-right: 8px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-dim);
  transform: translateY(-8px);
  font-family: var(--font-mono);
}

.cal-time-slot.night-slot {
  color: #475569;
}

.cal-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  position: relative;
  background: rgba(11, 15, 25, 0.4);
}

.cal-week-col {
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  min-height: calc(24 * 48px);
  min-width: 0;
  overflow: hidden;
}

.cal-hour-cell {
  height: 48px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: background 0.15s ease;
}

.cal-hour-cell:hover {
  background: rgba(255, 255, 255, 0.03);
}

.cal-hour-cell.night-cell {
  background: rgba(0, 0, 0, 0.15);
}

.cal-now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #ef4444;
  z-index: 10;
  pointer-events: none;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

.cal-now-line::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 10px #ef4444;
}

.cal-week-event-block {
  position: absolute;
  left: 4px;
  right: 4px;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 11.5px;
  overflow: hidden;
  z-index: 2;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease;
}

.cal-week-event-block:hover {
  transform: scale(1.02);
  z-index: 5;
}

/* 3. AGENDA VIEW */
.cal-agenda-view {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 650px;
  overflow-y: auto;
}

.cal-agenda-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cal-agenda-date-header {
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cal-agenda-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(15, 23, 42, 0.7);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  transition: var(--transition);
}

.cal-agenda-card:hover {
  background: rgba(30, 41, 69, 0.8);
  border-color: #6366f1;
  transform: translateX(4px);
}

.cal-agenda-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cal-agenda-time-badge {
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #a5b4fc;
}

.cal-agenda-details h4 {
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 3px;
}

.cal-agenda-details p {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   MAINTENANCE & RECURRING CARE TRACKER (INTERVAL COUNTDOWN)
   ========================================================================== */

.maintenance-today-alert {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(239, 68, 68, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 8px 32px rgba(245, 158, 11, 0.15);
  animation: pulseBorder 3s infinite ease-in-out;
}

@keyframes pulseBorder {
  0%, 100% { border-color: rgba(245, 158, 11, 0.4); }
  50% { border-color: rgba(239, 68, 68, 0.7); box-shadow: 0 0 25px rgba(239, 68, 68, 0.25); }
}

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

.alert-banner-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.alert-pulse-icon {
  font-size: 24px;
  animation: ringBell 2s infinite ease-in-out;
}

@keyframes ringBell {
  0%, 100% { transform: rotate(0deg); }
  10%, 30% { transform: rotate(14deg); }
  20%, 40% { transform: rotate(-14deg); }
  50% { transform: rotate(0deg); }
}

.alert-banner-title h4 {
  font-size: 16px;
  font-weight: 800;
  color: #fbbf24;
}

.maintenance-today-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.maintenance-today-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.maintenance-today-item:hover {
  background: rgba(30, 41, 69, 0.9);
  border-color: #fbbf24;
  transform: translateY(-2px);
}

.maintenance-today-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.maintenance-today-icon {
  font-size: 22px;
}

.maintenance-today-text h5 {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.maintenance-today-text span {
  font-size: 11.5px;
  color: #f87171;
  font-weight: 600;
}

.maintenance-today-item.sub-cancel-item {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(35, 15, 20, 0.8);
}

.maintenance-today-item.sub-cancel-item:hover {
  border-color: #ef4444;
  background: rgba(45, 18, 25, 0.95);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.25);
}

.maintenance-today-item.sub-cancel-item .maintenance-today-text span {
  color: #fca5a5;
}

.maintenance-today-item.task-item-due {
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(15, 25, 50, 0.8);
}

.maintenance-today-item.task-item-due:hover {
  border-color: #3b82f6;
  background: rgba(20, 35, 70, 0.95);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.25);
}

.maintenance-today-item.task-item-due .maintenance-today-text span {
  color: #93c5fd;
}

/* Maintenance Section Navigation Tabs */
.maintenance-filter-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.m-filter-btn {
  padding: 8px 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.m-filter-btn:hover {
  background: rgba(30, 41, 69, 0.8);
  color: #fff;
}

.m-filter-btn.active {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* Maintenance Cards Grid */
.maintenance-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.maintenance-card {
  background: linear-gradient(135deg, rgba(18, 24, 38, 0.9), rgba(12, 17, 29, 0.95));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  transition: var(--transition);
  box-shadow: var(--shadow-md);
}

.maintenance-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.maintenance-card.status-due {
  border-color: rgba(245, 158, 11, 0.6);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.15);
}

.maintenance-card.status-overdue {
  border-color: rgba(239, 68, 68, 0.7);
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.25);
}

.maintenance-card.status-fresh {
  border-color: rgba(16, 185, 129, 0.3);
}

.m-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.m-card-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.m-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.m-card-info h4 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 3px;
}

.m-card-info span {
  font-size: 12px;
  color: var(--text-dim);
}

.m-status-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-fresh {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-due-soon {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-overdue {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.m-card-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.m-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-dim);
}

.m-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 3px;
  overflow: hidden;
}

.m-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.m-progress-fill.fill-green {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.m-progress-fill.fill-amber {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.m-progress-fill.fill-red {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.m-card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12px;
  color: var(--text-dim);
}

.m-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-m-done {
  flex: 1;
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.2));
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #a7f3d0;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-m-done:hover {
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

/* Modern Service Table */
.modern-table {
  width: 100%;
  border-collapse: collapse;
}

.modern-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modern-table td {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-main);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modern-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ==========================================================================
   SUBSCRIPTIONS & RECURRING BILLING HUB
   ========================================================================== */

.sub-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.sub-summary-card {
  padding: 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sub-sum-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.sub-summary-card h4 {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
}

.sub-summary-card small {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Subscriptions Grid */
.subscriptions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.sub-card {
  background: linear-gradient(135deg, rgba(18, 24, 38, 0.9), rgba(15, 23, 42, 0.95));
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  transition: var(--transition);
}

.sub-card:hover {
  border-color: rgba(99, 102, 241, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.sub-card.sub-due-warning {
  border-color: rgba(245, 158, 11, 0.6);
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.15);
}

.sub-card.sub-overdue {
  border-color: rgba(239, 68, 68, 0.7);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

.sub-card.sub-paused {
  opacity: 0.65;
  filter: grayscale(0.5);
}

.sub-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sub-card-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sub-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.sub-info h4 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.sub-tags-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.sub-cycle-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.sub-price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.sub-price-amount {
  font-size: 17px;
  font-weight: 800;
  color: #38bdf8;
}

.sub-price-cycle {
  font-size: 11.5px;
  color: var(--text-dim);
}

.sub-next-billing {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
}

.sub-due-status-pill {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}

.sub-due-ok {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.sub-due-soon {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.sub-due-late {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.sub-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-sub-renew {
  flex: 1;
  padding: 7px 12px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #c7d2fe;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-sub-renew:hover {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
  color: #fff;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* ==========================================================================
   RESPONSIVE DESIGN & IPHONE / SAFARI OPTIMIZATIONS
   ========================================================================== */

/* Prevent iOS Safari font inflation / auto-zoom on form focus */
@media (max-width: 900px) {
  input,
  select,
  textarea,
  button {
    font-size: 16px !important;
  }
}

/* Tablet & Mobile Breakpoint (<= 1024px) */
@media (max-width: 1024px) {
  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, 85vw);
    transform: translateX(-100%);
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.8);
  }

  .btn-close-sidebar-mobile {
    display: flex;
  }

  .main-content {
    width: 100%;
    max-width: 100%;
    padding: 16px 16px calc(80px + var(--sab)) 16px;
  }

  .mobile-top-bar {
    display: flex;
    margin: -16px -16px 20px -16px;
  }

  .mobile-bottom-nav {
    display: flex;
  }

  .top-header {
    display: none; /* Replaced by mobile top bar on mobile */
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  .matrix-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .finance-overview-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  .finance-lists-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .mindmap-header-actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  .calendar-controls {
    flex-wrap: wrap;
    gap: 8px;
  }
}

/* Phone Breakpoint & iPhone Portrait (<= 640px) */
@media (max-width: 640px) {
  body {
    background-attachment: scroll; /* Smooth scrolling performance on mobile WebKit */
  }

  .main-content {
    padding: 12px 12px calc(76px + var(--sab)) 12px;
  }

  .mobile-top-bar {
    margin: -12px -12px 16px -12px;
    padding: max(12px, var(--sat)) 12px 10px 12px;
  }

  .stat-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .glass-card {
    padding: 16px !important;
    border-radius: 16px !important;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px;
  }

  .section-header .header-actions,
  .section-header .btn-group {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .section-header button {
    flex: 1;
    min-width: 120px;
  }

  /* Form & Inputs in Modals */
  .modal-overlay {
    padding: 12px !important;
    align-items: flex-end !important; /* Bottom-sheet feel on iPhone */
  }

  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90vh !important;
    max-height: 90dvh !important;
    border-radius: 20px 20px 10px 10px !important;
    padding: 20px 16px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .modal-body {
    max-height: 65vh !important;
    max-height: 65dvh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-right: 4px;
  }

  .modal-body div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .modal-footer {
    flex-wrap: wrap;
    gap: 8px;
  }

  .modal-footer .btn {
    flex: 1;
    min-width: 100px;
  }

  /* PIN Lock Screen on Mobile */
  .lock-box {
    width: 92% !important;
    max-width: 360px !important;
    padding: 28px 18px !important;
    border-radius: 24px !important;
  }

  .pin-pad {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
  }

  .pin-btn {
    width: 60px !important;
    height: 60px !important;
    font-size: 22px !important;
    border-radius: 50% !important;
    margin: 0 auto;
  }

  /* Habit Tracker Responsive */
  .habit-item {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px;
  }

  .habit-days {
    width: 100%;
    justify-content: space-between;
  }

  .habit-day-btn {
    width: 34px !important;
    height: 34px !important;
    font-size: 12px !important;
  }

  /* Maintenance & Vehicle Service Cards */
  .maintenance-grid,
  .vehicle-services-grid,
  .subscriptions-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Pomodoro Focus Screen */
  .pomodoro-display {
    width: 220px !important;
    height: 220px !important;
  }

  .pomodoro-timer-text {
    font-size: 42px !important;
  }

  .pomodoro-controls {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Mindmap on Mobile */
  .mindmap-canvas-container {
    height: 65vh !important;
    height: 65dvh !important;
    touch-action: pan-x pan-y pinch-zoom;
  }

  /* Google Style Calendar */
  .calendar-view-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .calendar-grid {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .calendar-grid-header,
  .calendar-grid-body {
    min-width: 320px;
  }

  .cal-day-cell {
    min-height: 60px !important;
    padding: 4px !important;
  }

  .cal-event-pill {
    font-size: 10px !important;
    padding: 2px 4px !important;
  }

  /* Toast Notification positioning on iPhone */
  .toast-container {
    bottom: calc(75px + var(--sab)) !important;
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
  }
}

/* Touch feedback for iOS */
@media (hover: none) and (pointer: coarse) {
  button,
  .nav-item,
  .mobile-nav-tab,
  .pin-btn,
  .habit-day-btn,
  .icon-btn,
  .btn-sub-renew {
    cursor: default;
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-user-select: none;
  }

  button:active,
  .icon-btn:active {
    opacity: 0.75;
  }
}
