/* ========================================================
   Planz App — Complete Standalone Silk Neomorphic CSS
   100% Self-Contained & Offline-First (No External CDN required)
   ======================================================== */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800;900&display=swap');

:root {
  /* Colors - Light Theme */
  --bg: #e8eaf0;
  --surface: #e8eaf0;
  --surface-card: #e8eaf0;
  --surface-hover: #edeef4;
  --text-main: #2e3040;
  --text-muted: #6b6e7f;
  --text-subtle: #9ca0b0;
  --border-subtle: rgba(0, 0, 0, 0.05);

  --primary: #6366f1;
  --primary-light: #e0e2ff;
  --primary-text: #4338ca;
  --tertiary: #7c3aed;
  --tertiary-light: #ede9fe;
  --error: #ef4444;
  --error-light: #fee2e2;
  --success: #10b981;
  --warning: #f59e0b;

  /* Neomorphic Shadows - Light */
  --neo-raised: 6px 6px 14px rgba(0, 0, 0, 0.08), -6px -6px 14px rgba(255, 255, 255, 0.75);
  --neo-raised-sm: 3px 3px 8px rgba(0, 0, 0, 0.07), -3px -3px 8px rgba(255, 255, 255, 0.8);
  --neo-raised-hover: 8px 8px 18px rgba(0, 0, 0, 0.12), -8px -8px 18px rgba(255, 255, 255, 0.9);
  --neo-inset: inset 4px 4px 8px rgba(0, 0, 0, 0.06), inset -4px -4px 8px rgba(255, 255, 255, 0.6);
  --neo-inset-sm: inset 2px 2px 5px rgba(0, 0, 0, 0.05), inset -2px -2px 5px rgba(255, 255, 255, 0.65);
  --neo-pill-active: inset 3px 3px 7px rgba(99, 102, 241, 0.25), inset -3px -3px 7px rgba(255, 255, 255, 0.7);
}

html.dark {
  /* Colors - Dark Theme (deep midnight palette) */
  --bg: #0f1117;
  --surface: #181b24;
  --surface-card: #1e2130;
  --surface-hover: #252a3a;
  --text-main: #eaecf4;
  --text-muted: #8b91a8;
  --text-subtle: #555a6e;
  --border-subtle: rgba(255, 255, 255, 0.06);

  --primary: #818cf8;
  --primary-light: #272b45;
  --primary-text: #c7d2fe;
  --tertiary: #a78bfa;
  --tertiary-light: #2e2245;
  --error: #f87171;
  --error-light: #3c1515;
  --success: #34d399;
  --warning: #fbbf24;

  /* Neomorphic Shadows - Dark (deeper, more premium) */
  --neo-raised: 7px 7px 18px rgba(0, 0, 0, 0.8), -4px -4px 12px rgba(255, 255, 255, 0.04);
  --neo-raised-sm: 4px 4px 10px rgba(0, 0, 0, 0.7), -3px -3px 8px rgba(255, 255, 255, 0.03);
  --neo-raised-hover: 10px 10px 24px rgba(0, 0, 0, 0.85), -6px -6px 16px rgba(255, 255, 255, 0.05);
  --neo-inset: inset 4px 4px 10px rgba(0, 0, 0, 0.75), inset -3px -3px 8px rgba(255, 255, 255, 0.035);
  --neo-inset-sm: inset 2px 2px 6px rgba(0, 0, 0, 0.7), inset -2px -2px 5px rgba(255, 255, 255, 0.025);
  --neo-pill-active: inset 3px 3px 8px rgba(99, 102, 241, 0.45), inset -2px -2px 6px rgba(255, 255, 255, 0.04);
}

/* ---- Dark-mode specific component overrides ---- */
html.dark body {
  background-color: var(--bg);
}

html.dark .sidebar,
html.dark .header {
  background-color: var(--surface);
}

html.dark .neo-raised {
  background-color: var(--surface-card);
}

html.dark .neo-raised-sm {
  background-color: var(--surface-card);
}

html.dark .neo-inset,
html.dark .neo-inset-sm {
  background-color: var(--bg);
}

html.dark .stat-card-label,
html.dark .widget-subtitle,
html.dark .form-label,
html.dark .profile-email,
html.dark .task-due,
html.dark .goal-details,
html.dark .brand-subtitle,
html.dark .header-greeting,
html.dark .stat-card-sub {
  color: var(--text-muted);
}

html.dark .stat-card-value,
html.dark .widget-title,
html.dark .brand-title,
html.dark .profile-name,
html.dark .task-title,
html.dark .goal-header span {
  color: var(--text-main);
}

html.dark .habit-table th {
  color: var(--text-muted);
}

html.dark .reflection-textarea,
html.dark .reflection-prompt-input,
html.dark .form-input,
html.dark .search-input,
html.dark .task-add-input {
  color: var(--text-main);
}

html.dark .reflection-textarea::placeholder,
html.dark .reflection-prompt-input::placeholder,
html.dark .form-input::placeholder,
html.dark .search-input::placeholder,
html.dark .task-add-input::placeholder {
  color: var(--text-subtle);
}

html.dark .empty-state-text {
  color: var(--text-muted);
}

html.dark .empty-state-btn {
  color: var(--primary);
}

html.dark .streak-footer,
html.dark .events-list {
  border-color: var(--border-subtle);
}

html.dark .task-title.done {
  color: var(--text-subtle);
}

html.dark .header-week-pill {
  background-color: var(--primary-light);
  color: var(--primary-text);
}

html.dark .nav-link {
  color: var(--text-muted);
}

html.dark .nav-link:hover {
  color: var(--text-main);
}

html.dark .nav-link.active {
  color: var(--primary);
}

html.dark .theme-toggle-btn {
  color: var(--text-main);
}

html.dark .header-btn {
  color: var(--text-muted);
}

html.dark .header-btn:hover {
  color: var(--primary);
}

html.dark .modal-overlay {
  background-color: rgba(5, 7, 12, 0.8);
}

html.dark .toast {
  background-color: var(--surface-card);
  color: var(--text-main);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
}

html.dark .cal-header-day {
  color: var(--text-muted);
}

html.dark .cal-day-cell {
  color: var(--text-main);
}

html.dark .event-item {
  color: var(--text-main);
}

html.dark .stat-pill {
  color: var(--text-muted);
}

html.dark .cta-new-entry {
  color: var(--primary);
}

html.dark select option {
  background-color: var(--surface-card);
  color: var(--text-main);
}

html.dark .header-btn-badge {
  border-color: var(--surface);
}

html.dark .sidebar {
  border-left: 1px solid rgba(255, 255, 255, 0.05);
}

html.dark .header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Scrollbar styling for dark mode */
html.dark ::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
html.dark ::-webkit-scrollbar-track {
  background: var(--bg);
}
html.dark ::-webkit-scrollbar-thumb {
  background: var(--text-subtle);
  border-radius: 9999px;
}
html.dark ::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Subtle glow on primary interactive elements in dark mode */
html.dark .neo-pill-active {
  box-shadow: var(--neo-pill-active), 0 0 12px rgba(129, 140, 248, 0.15);
}

html.dark .cta-new-entry.neo-raised {
  box-shadow: var(--neo-raised), 0 0 16px rgba(129, 140, 248, 0.1);
}


/* ========================================================
   BASE RESET
   ======================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  direction: rtl;
  text-align: right;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: transparent;
  outline: none;
}

input, textarea, select {
  font-family: inherit;
  color: inherit;
}

/* ========================================================
   NEOMORPHIC UTILITIES
   ======================================================== */
.neo-raised {
  background-color: var(--surface);
  box-shadow: var(--neo-raised);
  border-radius: 16px;
}

.neo-raised-sm {
  background-color: var(--surface);
  box-shadow: var(--neo-raised-sm);
  border-radius: 12px;
}

.neo-raised-hover {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.neo-raised-hover:hover {
  box-shadow: var(--neo-raised-hover);
  transform: translateY(-2px);
}

.neo-inset {
  background-color: var(--surface);
  box-shadow: var(--neo-inset);
  border-radius: 14px;
}

.neo-inset-sm {
  background-color: var(--surface);
  box-shadow: var(--neo-inset-sm);
  border-radius: 10px;
}

.neo-pill-active {
  background-color: var(--surface);
  box-shadow: var(--neo-pill-active);
  color: var(--primary) !important;
  border-radius: 12px;
}

.neo-btn-press:active {
  box-shadow: var(--neo-inset-sm) !important;
  transform: scale(0.97);
}

/* ========================================================
   LAYOUT: SIDEBAR (RIGHT) & HEADER (TOP)
   ======================================================== */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 260px;
  height: 100vh;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 50;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header {
  position: fixed;
  top: 0;
  right: 260px;
  left: 0;
  height: 72px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 40;
  border-bottom: 1px solid var(--border-subtle);
}

.main-content {
  margin-right: 260px;
  padding: 96px 32px 64px;
  max-width: 1440px;
  margin-left: auto;
  min-height: 100vh;
}

.content-container {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ========================================================
   SIDEBAR COMPONENTS
   ======================================================== */
.brand-box {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.cta-new-entry {
  width: 100%;
  padding: 12px 16px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  margin-top: 20px;
  margin-bottom: 12px;
}

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

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--text-main);
  box-shadow: var(--neo-raised-sm);
}

.nav-link.active {
  box-shadow: var(--neo-pill-active);
  color: var(--primary);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  position: relative;
  cursor: pointer;
}

.profile-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: bold;
  font-size: 14px;
  flex-shrink: 0;
}

.profile-info {
  flex: 1;
  min-width: 0;
}

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

.profile-email {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* ========================================================
   HEADER COMPONENTS
   ======================================================== */
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-date-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-week-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 9999px;
  background-color: var(--primary-light);
  color: var(--primary-text);
}

.header-greeting {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

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

.search-container {
  position: relative;
  width: 260px;
}

.search-input {
  width: 100%;
  padding: 10px 38px 10px 14px;
  border-radius: 12px;
  font-size: 12px;
  border: none;
  background: transparent;
  outline: none;
  color: var(--text-main);
}

.search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
}

.header-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  position: relative;
  transition: all 0.2s ease;
}

.header-btn:hover {
  color: var(--primary);
}

.header-btn-badge {
  position: absolute;
  top: 9px;
  left: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--primary);
  border: 2px solid var(--surface);
}

/* ========================================================
   SECTION 1: 4 TOP STAT CARDS
   ======================================================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.stat-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 155px;
}

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

.stat-card-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.stat-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-card-content {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: 14px;
}

.stat-card-value {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
}

.stat-card-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.stat-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.progress-track {
  width: 100%;
  height: 6px;
  border-radius: 9999px;
  margin-top: 14px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================================
   SECTION 2: BENTO ROW 1 (HABIT MATRIX & CALENDAR)
   ======================================================== */
.bento-row-1 {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: 28px;
}

.card-widget {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.widget-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.widget-header-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.widget-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.widget-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

/* Habit Matrix Table */
.habit-table-wrapper {
  overflow-x: auto;
  margin-top: 14px;
}

.habit-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  direction: rtl;
}

.habit-table th {
  padding: 10px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.habit-table td {
  padding: 12px 4px;
  font-size: 12px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.habit-name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.habit-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.day-btn {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  transition: all 0.15s ease;
}

.streak-footer {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

/* Calendar Widget */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  text-align: center;
  margin-top: 12px;
}

.cal-header-day {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px 0;
}

.cal-day-cell {
  padding: 6px 0;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 32px;
}

.cal-event-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  margin-top: 2px;
}

.events-list {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.event-item {
  padding: 10px 14px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.event-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.event-bar {
  width: 4px;
  height: 24px;
  border-radius: 9999px;
  flex-shrink: 0;
}

/* ========================================================
   SECTION 3: BENTO ROW 2 (TASKS, GOALS, REFLECTION)
   ======================================================== */
.bento-row-2 {
  display: grid;
  grid-template-columns: 5fr 4fr 3fr;
  gap: 28px;
}

/* Tasks */
.task-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
}

.task-tab-btn {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.task-tab-btn.active {
  box-shadow: var(--neo-pill-active);
  color: var(--primary);
}

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
  max-height: 300px;
  overflow-y: auto;
}

.task-card {
  padding: 12px 14px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.2s ease;
}

.task-card.completed {
  opacity: 0.65;
}

.task-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.task-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.task-title {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-title.done {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-due {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.task-add-form {
  position: relative;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.task-add-input {
  width: 100%;
  padding: 10px 42px 10px 14px;
  border-radius: 12px;
  font-size: 12px;
  border: none;
  background: transparent;
  outline: none;
  color: var(--text-main);
}

.task-add-btn {
  position: absolute;
  right: 8px;
  top: 22px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

/* Goals */
.goals-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 16px;
}

.goal-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.goal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 700;
}

.goal-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

/* Daily Reflection */
.reflection-box {
  padding: 14px;
  border-radius: 14px;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reflection-textarea {
  width: 100%;
  min-height: 90px;
  border: none;
  background: transparent;
  outline: none;
  resize: none;
  font-size: 12px;
  color: var(--text-main);
  line-height: 1.6;
}

.reflection-prompt {
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11.5px;
}

.reflection-prompt-title {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.reflection-prompt-input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ========================================================
   EMPTY STATES
   ======================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 16px;
  border-radius: 14px;
  gap: 10px;
}

.empty-state-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  margin-bottom: 4px;
}

.empty-state-text {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  max-width: 260px;
}

.empty-state-btn {
  margin-top: 6px;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}

/* ========================================================
   MODAL & TOAST
   ======================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 17, 24, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  width: 100%;
  max-width: 480px;
  padding: 26px;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .modal-dialog {
  transform: scale(1);
}

.modal-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  text-align: center;
}

.modal-tab-btn {
  padding: 8px 0;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.modal-tab-btn.active {
  box-shadow: var(--neo-pill-active);
  color: var(--primary);
}

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

.form-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  border: none;
  background: transparent;
  outline: none;
  font-size: 12.5px;
  color: var(--text-main);
}

.toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 150;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ========================================================
   RESPONSIVENESS (TABLET & MOBILE)
   ======================================================== */
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
}

@media (max-width: 1100px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .bento-row-1 {
    grid-template-columns: 1fr;
  }
  .bento-row-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .header {
    right: 0;
  }
  .main-content {
    margin-right: 0;
    padding: 88px 16px 48px;
  }
  .mobile-menu-btn {
    display: flex;
  }
  .search-container {
    display: none;
  }
}

@media (max-width: 640px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
  .header {
    padding: 0 16px;
  }
}

/* ========================================================
   CLOUD SYNC WIDGET & BADGE
   ======================================================== */
.cloud-sync-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 600;
  transition: all 0.25s ease;
  user-select: none;
}

.cloud-sync-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cloud-sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success);
  transition: all 0.3s ease;
}

.cloud-sync-dot.synced {
  background-color: var(--success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.cloud-sync-dot.syncing {
  background-color: var(--warning);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
  animation: syncPulse 1s infinite alternate;
}

.cloud-sync-dot.offline {
  background-color: var(--text-subtle);
  box-shadow: none;
}

.cloud-sync-dot.error {
  background-color: var(--error);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

@keyframes syncPulse {
  from { opacity: 0.5; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1.15); }
}

.cloud-sync-btn {
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.cloud-sync-btn:hover {
  filter: brightness(1.1);
}

.cloud-sync-btn.spin svg {
  animation: spinIcon 1s linear infinite;
}

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

html.dark .cloud-sync-bar {
  background-color: var(--surface-card);
}

