.module-switcher-panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 24px;
  padding: 20px 22px;
  border: 1px solid rgba(58, 134, 255, 0.16);
  border-radius: 22px;
  background: linear-gradient(
    180deg,
    rgba(8, 17, 33, 0.9),
    rgba(7, 14, 29, 0.96)
  );
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.module-switcher-copy {
  max-width: 620px;
}

.module-switcher-panel h2 {
  margin: 6px 0 8px;
  font-size: 1.55rem;
}

.module-switcher-description {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.module-switcher-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.module-tab {
  border: 1px solid rgba(58, 134, 255, 0.18);
  background: rgba(58, 134, 255, 0.08);
  color: var(--text);
  border-radius: 999px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
}

.module-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 217, 255, 0.32);
}

.module-tab.active,
.sidebar-nav .nav-item.active {
  background: linear-gradient(
    135deg,
    rgba(58, 134, 255, 0.22),
    rgba(0, 217, 255, 0.16)
  );
  border-color: rgba(0, 217, 255, 0.34);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.16);
}

.module-section {
  display: block;
}

.module-section.hidden {
  display: none;
}

.module-mini-grid {
  margin-bottom: 24px;
}

.module-placeholder-panel {
  padding: 22px;
}

.module-placeholder-panel .panel-header {
  margin-bottom: 16px;
}

.module-placeholder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.module-placeholder-card {
  border: 1px solid rgba(58, 134, 255, 0.14);
  background: linear-gradient(
    180deg,
    rgba(9, 18, 37, 0.84),
    rgba(6, 12, 24, 0.92)
  );
  border-radius: 18px;
  padding: 18px;
  min-height: 138px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.module-placeholder-card h3 {
  margin: 0 0 8px;
  font-size: 1.02rem;
  line-height: 1.35;
}

.module-placeholder-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.58;
  font-size: 0.96rem;
}

.module-placeholder-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  margin-bottom: 12px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #cfe4ff;
  background: rgba(58, 134, 255, 0.12);
  border: 1px solid rgba(58, 134, 255, 0.18);
}

@media (max-width: 1024px) {
  .module-switcher-panel {
    flex-direction: column;
    align-items: flex-start;
  }

  .module-placeholder-panel {
    padding: 20px;
  }

  .module-placeholder-grid {
    grid-template-columns: 1fr;
  }
}

.module-functional-panel {
  padding: 24px;
}

.module-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.module-inline-filter {
  display: flex;
  align-items: center;
  gap: 10px;
}

.module-inline-filter label {
  color: var(--muted);
  font-size: 0.92rem;
}

.module-inline-filter select {
  min-width: 180px;
  border-radius: 14px;
  border: 1px solid rgba(58, 134, 255, 0.14);
  background: rgba(9, 18, 36, 0.88);
  color: var(--text);
  padding: 12px 14px;
}

.module-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.module-chip-row-bottom {
  margin-bottom: 18px;
}

.module-item-list,
.habit-grid {
  display: grid;
  gap: 16px;
}

.habit-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.module-item-card {
  border-radius: 22px;
  border: 1px solid rgba(58, 134, 255, 0.14);
  background: linear-gradient(
    180deg,
    rgba(8, 17, 33, 0.92),
    rgba(4, 11, 25, 0.98)
  );
  padding: 18px 20px;
  overflow: hidden;
}

.module-item-topline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.module-item-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.module-item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.module-item-card h3 {
  margin: 0 0 8px;
  font-size: 1.08rem;
  line-height: 1.35;
}

.module-item-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.58;
}

.module-item-meta {
  margin-top: 14px;
  font-size: 0.9rem;
  color: #9db7de;
}

.module-action-button {
  border: 1px solid rgba(58, 134, 255, 0.18);
  background: rgba(58, 134, 255, 0.08);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
}

.module-action-button:hover {
  background: rgba(58, 134, 255, 0.14);
}

.priority-low {
  background: rgba(0, 217, 255, 0.08);
  border-color: rgba(0, 217, 255, 0.18);
}

.priority-medium {
  background: rgba(255, 209, 102, 0.1);
  border-color: rgba(255, 209, 102, 0.18);
}

.priority-high,
.tag-danger {
  background: rgba(255, 95, 122, 0.12);
  border-color: rgba(255, 95, 122, 0.24);
}

.status-todo {
  background: rgba(58, 134, 255, 0.12);
}

.status-doing,
.tag-accent {
  background: rgba(0, 217, 255, 0.1);
  border-color: rgba(0, 217, 255, 0.18);
}

.status-done,
.tag-success {
  background: rgba(0, 255, 156, 0.12);
  border-color: rgba(0, 255, 156, 0.2);
}

.task-overdue {
  box-shadow: inset 0 0 0 1px rgba(255, 95, 122, 0.14);
}

.habit-card-done {
  box-shadow: inset 0 0 0 1px rgba(0, 255, 156, 0.12);
}

@media (max-width: 1024px) {
  .module-toolbar,
  .module-item-topline {
    flex-direction: column;
    align-items: stretch;
  }

  .module-inline-filter select {
    min-width: 100%;
  }
}

.hidden {
  display: none !important;
}

.startup-error-panel {
  width: 100%;
  margin-top: 22px;
}

.goals-panel {
  margin-bottom: 22px;
}

.goals-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.goals-progress-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.goal-progress-card {
  min-height: 170px;
}

.goal-progress-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin: 12px 0 10px;
}

.goal-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(0, 217, 255, 0.85),
    rgba(58, 134, 255, 0.95)
  );
  transition: width 0.35s ease;
}

@media (max-width: 1080px) {
  .goals-form-grid,
  .goals-progress-grid {
    grid-template-columns: 1fr;
  }
}

/* =============================
   GOALS PANEL - VISUAL PREMIUM
============================= */
.goals-panel-premium {
  padding: 22px 22px 20px;
  margin-bottom: 26px;
}

.goals-panel-header {
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.goals-helper {
  margin: 10px 0 0;
  max-width: 760px;
  color: #9db3d7;
  line-height: 1.55;
  font-size: 14px;
}

.goals-save-button {
  min-width: 150px;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 16px;
  box-shadow: 0 14px 34px rgba(0, 188, 255, 0.18);
}

.goals-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.goals-form-group {
  background: linear-gradient(
    180deg,
    rgba(12, 21, 40, 0.9),
    rgba(8, 17, 33, 0.92)
  );
  border: 1px solid rgba(58, 134, 255, 0.12);
  border-radius: 18px;
  padding: 14px 14px 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.goals-form-group label {
  display: block;
  margin-bottom: 10px;
  color: #d9e8ff;
  font-weight: 600;
  font-size: 13px;
}

.goals-input {
  height: 52px;
  border-radius: 14px;
  border: 1px solid rgba(58, 134, 255, 0.18);
  background: rgba(6, 14, 28, 0.9);
  padding: 0 16px;
  color: #f2f7ff;
  font-size: 15px;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.goals-input::placeholder {
  color: rgba(185, 207, 255, 0.45);
}

.goals-input:focus {
  outline: none;
  border-color: rgba(0, 217, 255, 0.45);
  box-shadow:
    0 0 0 4px rgba(0, 217, 255, 0.09),
    0 10px 26px rgba(0, 0, 0, 0.2);
  background: rgba(8, 17, 33, 0.98);
}

.goals-progress-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.goal-progress-card {
  min-height: 192px;
  padding: 18px 20px;
  border-radius: 22px;
  background: linear-gradient(
    180deg,
    rgba(10, 20, 40, 0.98),
    rgba(7, 14, 28, 0.98)
  );
}

.goal-progress-card .stat-label {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8ca6ca;
}

.goal-progress-card .stat-value.small {
  font-size: 19px;
  line-height: 1.3;
  margin-top: 6px;
  min-height: 50px;
}

.goal-progress-card .stat-footnote {
  color: #9cb4d7;
  line-height: 1.55;
  font-size: 14px;
}

.goal-progress-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.03)
  );
  border: 1px solid rgba(255, 255, 255, 0.04);
  overflow: hidden;
  margin: 14px 0 12px;
  position: relative;
}

.goal-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(0, 217, 255, 0.85),
    rgba(58, 134, 255, 0.95),
    rgba(111, 247, 255, 0.9)
  );
  box-shadow: 0 0 14px rgba(0, 217, 255, 0.35);
  transition: width 0.35s ease;
}

.goal-state-empty .goal-progress-fill {
  box-shadow: none;
  background: linear-gradient(
    90deg,
    rgba(95, 114, 140, 0.35),
    rgba(95, 114, 140, 0.2)
  );
}

.goal-state-stopped .goal-progress-fill {
  background: linear-gradient(
    90deg,
    rgba(255, 95, 122, 0.8),
    rgba(255, 142, 110, 0.78)
  );
  box-shadow: 0 0 14px rgba(255, 95, 122, 0.18);
}

.goal-state-progress .goal-progress-fill {
  background: linear-gradient(
    90deg,
    rgba(0, 217, 255, 0.84),
    rgba(58, 134, 255, 0.95)
  );
}

.goal-state-almost .goal-progress-fill {
  background: linear-gradient(
    90deg,
    rgba(255, 200, 87, 0.92),
    rgba(255, 152, 0, 0.92)
  );
  box-shadow: 0 0 16px rgba(255, 182, 64, 0.22);
}

.goal-state-done .goal-progress-fill {
  background: linear-gradient(
    90deg,
    rgba(0, 255, 156, 0.88),
    rgba(0, 217, 255, 0.92)
  );
  box-shadow: 0 0 16px rgba(0, 255, 156, 0.22);
}

@media (max-width: 1180px) {
  .goals-panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .goals-save-button {
    width: 100%;
  }
}

@media (max-width: 1080px) {
  .goals-form-grid,
  .goals-progress-grid {
    grid-template-columns: 1fr;
  }

  .goal-progress-card {
    min-height: 172px;
  }
}

/* =============================
   GLOBAL VISUAL POLISH OVERRIDES
============================= */
.main-content {
  max-width: 1520px;
  margin: 0 auto;
  padding: 28px 34px 44px;
}

.hero-header,
.module-switcher-panel,
.toolbar-panel,
.goals-panel,
.module-functional-panel,
.module-placeholder-panel,
.chart-panel,
.table-panel,
.insight-panel {
  border-radius: 26px;
}

.hero-header {
  min-height: 212px;
  padding: 34px 32px 26px;
  margin-bottom: 22px;
}

.module-switcher-panel,
.toolbar-panel,
.goals-panel {
  padding: 26px 28px;
}

.module-switcher-description,
.goals-helper,
.hero-description,
.stat-footnote,
.goal-progress-card .stat-footnote {
  color: #9fb5d6;
}

.cards-grid-main {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
}

.cards-grid-main .stat-card:first-child {
  grid-column: span 1;
}

.summary-grid,
.module-mini-grid,
.goals-progress-grid {
  gap: 18px;
}

.stat-card {
  min-height: 172px;
  padding: 24px 22px;
  border-radius: 24px;
}

.stat-card-featured {
  min-height: 182px;
}

.panel {
  padding: 24px;
}

.goals-panel-header {
  align-items: center;
  margin-bottom: 18px;
}

.goals-form-grid {
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

.goals-form-group label {
  margin-bottom: 8px;
  font-size: 0.92rem;
  color: #b5c8e7;
}

.goals-input,
.filters-inline select,
.filters-inline input,
.table-filters input,
.table-filters select,
.module-inline-filter select,
.module-inline-filter input {
  height: 50px !important;
  border-radius: 14px !important;
  padding: 0 16px !important;
  background: rgba(6, 14, 28, 0.92) !important;
  border: 1px solid rgba(58, 134, 255, 0.16) !important;
  color: #eef5ff !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.goals-input:focus,
.filters-inline select:focus,
.filters-inline input:focus,
.table-filters input:focus,
.table-filters select:focus,
.module-inline-filter select:focus,
.module-inline-filter input:focus {
  outline: none;
  border-color: rgba(0, 217, 255, 0.42) !important;
  box-shadow:
    0 0 0 4px rgba(0, 217, 255, 0.08),
    0 10px 24px rgba(0, 0, 0, 0.18) !important;
}

.goals-save-button,
.primary-button,
.secondary-button {
  min-height: 50px;
  border-radius: 14px;
}

.goals-save-button {
  min-width: 158px;
}

.goal-progress-card {
  min-height: 214px;
  padding: 22px 22px 20px;
  border-radius: 24px;
  background: linear-gradient(
    180deg,
    rgba(10, 20, 40, 0.98),
    rgba(6, 13, 26, 0.98)
  );
}

.goal-progress-card .stat-value.small {
  min-height: 58px;
  display: flex;
  align-items: flex-start;
  font-size: 1.52rem;
}

.goal-progress-bar {
  height: 14px;
  margin: 16px 0 14px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.02)
  );
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.22);
}

.goal-progress-fill {
  box-shadow:
    0 0 16px rgba(0, 217, 255, 0.28),
    inset 0 0 8px rgba(255, 255, 255, 0.08);
}

.module-functional-panel .panel-header,
.module-placeholder-panel .panel-header,
.goals-panel .panel-header {
  margin-bottom: 20px;
}

.module-functional-panel .panel-header h2,
.module-placeholder-panel .panel-header h2,
.goals-panel .panel-header h2 {
  font-size: 1.7rem;
}

.module-functional-panel .panel-eyebrow,
.module-placeholder-panel .panel-eyebrow,
.goals-panel .panel-eyebrow {
  margin-bottom: 10px;
}

.task-card,
.habit-card,
.routine-item,
.habit-item {
  border-radius: 18px;
}

@media (max-width: 1280px) {
  .cards-grid-main {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .goals-form-grid,
  .goals-progress-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .main-content {
    padding: 20px 16px 34px;
  }

  .cards-grid-main,
  .summary-grid,
  .module-mini-grid {
    grid-template-columns: 1fr;
  }

  .hero-header,
  .module-switcher-panel,
  .toolbar-panel,
  .goals-panel,
  .module-functional-panel,
  .module-placeholder-panel,
  .chart-panel,
  .table-panel,
  .insight-panel {
    padding: 20px;
  }
}
