:root {
  --fc-bg-dark: #16231d;
  --fc-bg-dark-alt: #223429;
  --fc-surface-dark: rgba(25, 38, 31, 0.78);
  --fc-surface-dark-strong: rgba(29, 43, 35, 0.92);
  --fc-surface-dark-soft: rgba(16, 24, 20, 0.38);
  --fc-border-dark: rgba(190, 218, 204, 0.12);
  --fc-border-dark-strong: rgba(138, 178, 158, 0.34);
  --fc-text-dark: #edf5ef;
  --fc-text-dark-soft: #d3e1d7;
  --fc-text-dark-muted: #9cb3a4;
  --fc-accent: #76b69b;
  --fc-accent-strong: #4d8b72;
  --fc-accent-soft: #dcebe3;
  --fc-accent-wash: rgba(118, 182, 155, 0.14);
  --fc-accent-glow: rgba(95, 152, 125, 0.22);
  --fc-highlight: #934250;
  --fc-highlight-soft: #f0dadd;
  --fc-highlight-wash: rgba(147, 66, 80, 0.16);
  --fc-shadow-dark: 0 18px 36px rgba(7, 11, 9, 0.22);

  --fc-bg-light: #f2f6f3;
  --fc-bg-light-alt: #e4ede8;
  --fc-surface-light: rgba(255, 255, 255, 0.92);
  --fc-surface-light-strong: #ffffff;
  --fc-surface-light-soft: #eef4f0;
  --fc-border-light: rgba(76, 107, 92, 0.14);
  --fc-border-light-strong: rgba(76, 107, 92, 0.26);
  --fc-text-light: #1f2d25;
  --fc-text-light-soft: #365044;
  --fc-text-light-muted: #667d71;
  --fc-shadow-light: 0 18px 32px rgba(31, 45, 37, 0.08);
}

meta[name="theme-color"] {
  color: #223429;
}

body {
  accent-color: var(--fc-accent-strong);
}

body[data-theme="dark"] {
  background: linear-gradient(135deg, var(--fc-bg-dark) 0%, var(--fc-bg-dark-alt) 100%);
  color: var(--fc-text-dark);
}

body[data-theme="light"] {
  background: linear-gradient(135deg, var(--fc-bg-light) 0%, var(--fc-bg-light-alt) 100%);
  color: var(--fc-text-light);
}

body[data-theme="dark"] h1,
body[data-theme="dark"] .header-title,
body[data-theme="light"] h1,
body[data-theme="light"] .header-title {
  background: linear-gradient(90deg, var(--fc-accent-strong), var(--fc-accent-soft));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

body[data-theme="dark"] :is(.subtitle, .header-subtitle, .metric-label, .level-label, .task-label, .history-time, .click-hint, .live-timer, .agent-progress-text, .settings-label, .task-bullets li, .task-details-label, .library-hours-meta, .library-hours-row-note, .library-hours-footnote, .focus-save-hint, .calendar-legend, .cycle-stat-label, .history-label, .recent-activity-time),
body[data-theme="light"] :is(.subtitle, .header-subtitle, .metric-label, .level-label, .task-label, .history-time, .click-hint, .live-timer, .agent-progress-text, .settings-label, .task-bullets li, .task-details-label, .library-hours-meta, .library-hours-row-note, .library-hours-footnote, .focus-save-hint, .calendar-legend, .cycle-stat-label, .history-label, .recent-activity-time) {
  color: var(--fc-text-dark-muted);
}

body[data-theme="light"] :is(.subtitle, .header-subtitle, .metric-label, .level-label, .task-label, .history-time, .click-hint, .live-timer, .agent-progress-text, .settings-label, .task-bullets li, .task-details-label, .library-hours-meta, .library-hours-row-note, .library-hours-footnote, .focus-save-hint, .calendar-legend, .cycle-stat-label, .history-label, .recent-activity-time) {
  color: var(--fc-text-light-muted);
}

body[data-theme="dark"] :is(.nav-container, .card, .agent-card, .agent-card-modern, .status-card, .hierarchy-level, .task-container, .task-container-modern, .delegation-flow-card, .focus-cockpit-card, .focus-card, .life-card, .library-hours-status, .library-hours-row, .quick-action-btn, .settings-dropdown, .settings-container, .calendar-day, .calendar-day.today, .calendar-day.current-workout, .workout-card, .calisthenics-section, .task-details-content, .focus-settings-row input, .focus-priority-input, .focus-btn, .focus-metric, .news-card, .schedule-card, .study-card, .model-badge-card),
body[data-theme="dark"] .dashboard-header {
  background: var(--fc-surface-dark);
  border-color: var(--fc-border-dark);
  box-shadow: var(--fc-shadow-dark);
  backdrop-filter: blur(14px);
}

body[data-theme="light"] :is(.nav-container, .card, .agent-card, .agent-card-modern, .status-card, .hierarchy-level, .task-container, .task-container-modern, .delegation-flow-card, .focus-cockpit-card, .focus-card, .life-card, .library-hours-status, .library-hours-row, .quick-action-btn, .settings-dropdown, .settings-container, .calendar-day, .calendar-day.today, .calendar-day.current-workout, .workout-card, .calisthenics-section, .task-details-content, .focus-settings-row input, .focus-priority-input, .focus-btn, .focus-metric, .news-card, .schedule-card, .study-card, .model-badge-card),
body[data-theme="light"] .dashboard-header {
  background: var(--fc-surface-light);
  border-color: var(--fc-border-light);
  box-shadow: var(--fc-shadow-light);
}

body[data-theme="dark"] :is(.card:hover, .agent-card:hover, .agent-card-modern:hover, .status-card:hover, .workout-card:hover, .quick-action-btn:hover, .calendar-day:hover, .news-card:hover, .study-card:hover),
body[data-theme="light"] :is(.card:hover, .agent-card:hover, .agent-card-modern:hover, .status-card:hover, .workout-card:hover, .quick-action-btn:hover, .calendar-day:hover, .news-card:hover, .study-card:hover) {
  border-color: rgba(147, 66, 80, 0.48);
  box-shadow: 0 18px 34px rgba(31, 18, 21, 0.14);
  transform: translateY(-2px);
}

body[data-theme="dark"] :is(.nav-brand, .agent-name, .agent-info h3, .section-title, .status-card-title, .library-hours-status-title, .library-hours-row-day, .task-title, .metric-value, .status-card-value, .task-text, .task-details-text, .library-hours-row-time, .focus-check-item),
body[data-theme="light"] :is(.nav-brand, .agent-name, .agent-info h3, .section-title, .status-card-title, .library-hours-status-title, .library-hours-row-day, .task-title, .metric-value, .status-card-value, .task-text, .task-details-text, .library-hours-row-time, .focus-check-item) {
  color: var(--fc-text-dark);
}

body[data-theme="light"] :is(.nav-brand, .agent-name, .agent-info h3, .section-title, .status-card-title, .library-hours-status-title, .library-hours-row-day, .task-title, .metric-value, .status-card-value, .task-text, .task-details-text, .library-hours-row-time, .focus-check-item) {
  color: var(--fc-text-light);
}

body[data-theme="dark"] :is(.agent-role, .task-text.delegation, .coordination-indicator, .recent-activity-item[data-agent="rodrigo"] .recent-activity-agent, .live-activity-item[data-agent="rodrigo"] .live-activity-agent, .focus-btn.primary, .focus-preset-btn.active, a, .inline-link, .week-number, .cycle-stat-value),
body[data-theme="light"] :is(.agent-role, .task-text.delegation, .coordination-indicator, .recent-activity-item[data-agent="rodrigo"] .recent-activity-agent, .live-activity-item[data-agent="rodrigo"] .live-activity-agent, .focus-btn.primary, .focus-preset-btn.active, a, .inline-link, .week-number, .cycle-stat-value) {
  color: var(--fc-accent);
}

body[data-theme="dark"] :is(.nav-tab, .lang-btn, .theme-btn, .settings-btn, .sidebar-collapse-btn),
body[data-theme="light"] :is(.nav-tab, .lang-btn, .theme-btn, .settings-btn, .sidebar-collapse-btn) {
  color: inherit;
  border-color: transparent;
}

body[data-theme="dark"] :is(.nav-tab, .lang-btn, .theme-btn, .settings-btn, .sidebar-collapse-btn, .hero-action-btn, .primary-cta, .secondary-cta, .page-primary-action, .calendar-nav-btn, .quick-jump-btn, .back-to-top-btn, .setting-btn, #jokeBtn, .focus-btn, .focus-preset-btn, .group-selector-select, .login-input, .setting-input, .focus-settings-row input, .focus-priority-input),
body[data-theme="light"] :is(.nav-tab, .lang-btn, .theme-btn, .settings-btn, .sidebar-collapse-btn, .hero-action-btn, .primary-cta, .secondary-cta, .page-primary-action, .calendar-nav-btn, .quick-jump-btn, .back-to-top-btn, .setting-btn, #jokeBtn, .focus-btn, .focus-preset-btn, .group-selector-select, .login-input, .setting-input, .focus-settings-row input, .focus-priority-input) {
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

body[data-theme="dark"] :is(.hero-action-btn, .primary-cta, .page-primary-action, .quick-jump-btn, .back-to-top-btn, .calendar-nav-btn, .focus-btn.primary, .focus-preset-btn.active, .coordination-indicator, .model-badge-card),
body[data-theme="light"] :is(.hero-action-btn, .primary-cta, .page-primary-action, .quick-jump-btn, .back-to-top-btn, .calendar-nav-btn, .focus-btn.primary, .focus-preset-btn.active, .coordination-indicator, .model-badge-card) {
  background: var(--fc-accent-wash);
  border-color: rgba(118, 182, 155, 0.34);
  color: var(--fc-accent-soft);
}

body[data-theme="light"] :is(.hero-action-btn, .primary-cta, .page-primary-action, .quick-jump-btn, .back-to-top-btn, .calendar-nav-btn, .focus-btn.primary, .focus-preset-btn.active, .coordination-indicator, .model-badge-card) {
  color: var(--fc-accent-strong);
}

body[data-theme="dark"] :is(.nav-tab:hover, .lang-btn:hover, .theme-btn:hover, .settings-btn:hover, .sidebar-collapse-btn:hover, .hero-action-btn:hover, .primary-cta:hover, .secondary-cta:hover, .page-primary-action:hover, .calendar-nav-btn:hover, .quick-jump-btn:hover, .back-to-top-btn:hover, .setting-btn:hover, #jokeBtn:hover, .focus-btn:hover, .focus-preset-btn:hover, .nav-menu-mobile .nav-tab:hover, .nav-menu-mobile .nav-tab:active),
body[data-theme="light"] :is(.nav-tab:hover, .lang-btn:hover, .theme-btn:hover, .settings-btn:hover, .sidebar-collapse-btn:hover, .hero-action-btn:hover, .primary-cta:hover, .secondary-cta:hover, .page-primary-action:hover, .calendar-nav-btn:hover, .quick-jump-btn:hover, .back-to-top-btn:hover, .setting-btn:hover, #jokeBtn:hover, .focus-btn:hover, .focus-preset-btn:hover, .nav-menu-mobile .nav-tab:hover, .nav-menu-mobile .nav-tab:active) {
  color: var(--fc-highlight-soft);
  border-color: rgba(147, 66, 80, 0.5);
  background: var(--fc-highlight-wash);
  box-shadow: 0 10px 22px rgba(72, 23, 32, 0.16);
}

body[data-theme="light"] :is(.nav-tab:hover, .lang-btn:hover, .theme-btn:hover, .settings-btn:hover, .sidebar-collapse-btn:hover, .hero-action-btn:hover, .primary-cta:hover, .secondary-cta:hover, .page-primary-action:hover, .calendar-nav-btn:hover, .quick-jump-btn:hover, .back-to-top-btn:hover, .setting-btn:hover, #jokeBtn:hover, .focus-btn:hover, .focus-preset-btn:hover, .nav-menu-mobile .nav-tab:hover, .nav-menu-mobile .nav-tab:active) {
  color: var(--fc-highlight);
}

body[data-theme="dark"] :is(.nav-tab.active, .nav-menu-mobile .nav-tab.active, .lang-btn.active, .theme-btn.active),
body[data-theme="light"] :is(.nav-tab.active, .nav-menu-mobile .nav-tab.active, .lang-btn.active, .theme-btn.active) {
  color: var(--fc-accent-soft);
  border-color: rgba(118, 182, 155, 0.42);
  background: linear-gradient(135deg, rgba(77, 139, 114, 0.28), rgba(118, 182, 155, 0.16));
  box-shadow: inset 0 0 0 1px rgba(118, 182, 155, 0.18);
}

body[data-theme="light"] :is(.nav-tab.active, .nav-menu-mobile .nav-tab.active, .lang-btn.active, .theme-btn.active) {
  color: var(--fc-accent-strong);
}

body[data-theme="dark"] :is(.status-text.working, .status-text.status-working, .live-badge-text, .calendar-day.today .day-number, .calendar-day.current-workout .day-number),
body[data-theme="light"] :is(.status-text.working, .status-text.status-working, .live-badge-text, .calendar-day.today .day-number, .calendar-day.current-workout .day-number) {
  color: var(--fc-accent);
}

body[data-theme="dark"] :is(.live-pulse-dot, .status-indicator.working, .status-indicator.status-working, .legend-color.today),
body[data-theme="light"] :is(.live-pulse-dot, .status-indicator.working, .status-indicator.status-working, .legend-color.today) {
  background: var(--fc-accent);
  box-shadow: 0 0 0 1px rgba(118, 182, 155, 0.42), 0 0 12px rgba(118, 182, 155, 0.2);
}

body[data-theme="dark"] :is(.status-indicator::after, .status-indicator.working::after, .status-indicator.status-working::after),
body[data-theme="light"] :is(.status-indicator::after, .status-indicator.working::after, .status-indicator.status-working::after) {
  background: radial-gradient(circle, rgba(118, 182, 155, 0.34) 0%, rgba(118, 182, 155, 0.12) 55%, rgba(118, 182, 155, 0) 100%);
}

body[data-theme="dark"] :is(.progress-fill, .agent-progress-fill, .agent-progress-fill-mini, .level-progress-fill),
body[data-theme="light"] :is(.progress-fill, .agent-progress-fill, .agent-progress-fill-mini, .level-progress-fill) {
  background: linear-gradient(90deg, var(--fc-accent-strong), var(--fc-accent));
}

body[data-theme="dark"] :is(.selected-workout, .library-hours-row.is-today, .calendar-day.today, .calendar-day.current-workout, .focus-home-card),
body[data-theme="light"] :is(.selected-workout, .library-hours-row.is-today, .calendar-day.today, .calendar-day.current-workout, .focus-home-card) {
  border-color: rgba(118, 182, 155, 0.42);
  box-shadow: 0 12px 24px rgba(60, 98, 80, 0.16);
}

body[data-theme="dark"] .library-hours-status.is-open,
body[data-theme="dark"] .library-hours-row.is-currently-open,
body[data-theme="light"] .library-hours-status.is-open,
body[data-theme="light"] .library-hours-row.is-currently-open {
  border-color: rgba(118, 182, 155, 0.42);
  background: linear-gradient(135deg, rgba(118, 182, 155, 0.16), rgba(18, 28, 23, 0.04));
}

body[data-theme="dark"] .library-hours-status.is-warning,
body[data-theme="light"] .library-hours-status.is-warning {
  border-color: rgba(191, 129, 67, 0.42);
  background: linear-gradient(135deg, rgba(191, 129, 67, 0.16), rgba(18, 28, 23, 0.04));
}

body[data-theme="dark"] .library-hours-status.is-closed,
body[data-theme="light"] .library-hours-status.is-closed {
  border-color: rgba(147, 66, 80, 0.38);
  background: linear-gradient(135deg, rgba(147, 66, 80, 0.14), rgba(18, 28, 23, 0.04));
}

body[data-theme="dark"] .library-hours-status-badge,
body[data-theme="light"] .library-hours-status-badge {
  background: rgba(19, 28, 23, 0.46);
  border-color: rgba(255, 255, 255, 0.08);
}

body[data-theme="light"] .library-hours-status-badge {
  background: var(--fc-surface-light-soft);
  border-color: var(--fc-border-light);
}

body[data-theme="dark"] :is(.nav-brand:focus-visible, .sidebar-collapse-btn:focus-visible, .quick-jump-btn:focus-visible, .back-to-top-btn:focus-visible, .nav-tab:focus-visible, .agent-card:focus-visible, .hero-action-btn:focus-visible, .calendar-nav-btn:focus-visible, .settings-btn:focus-visible, .primary-cta:focus-visible, .secondary-cta:focus-visible, .page-primary-action:focus-visible, .group-selector-select:focus-visible, .setting-input:focus-visible, .login-input:focus-visible, .focus-btn:focus-visible),
body[data-theme="light"] :is(.nav-brand:focus-visible, .sidebar-collapse-btn:focus-visible, .quick-jump-btn:focus-visible, .back-to-top-btn:focus-visible, .nav-tab:focus-visible, .agent-card:focus-visible, .hero-action-btn:focus-visible, .calendar-nav-btn:focus-visible, .settings-btn:focus-visible, .primary-cta:focus-visible, .secondary-cta:focus-visible, .page-primary-action:focus-visible, .group-selector-select:focus-visible, .setting-input:focus-visible, .login-input:focus-visible, .focus-btn:focus-visible) {
  outline-color: var(--fc-accent);
  box-shadow: 0 0 0 3px rgba(118, 182, 155, 0.26);
}

body[data-theme="dark"] .nav-container {
  background: rgba(22, 34, 28, 0.92);
  border-right-color: rgba(220, 235, 226, 0.08);
}

body[data-theme="light"] .nav-container {
  background: rgba(251, 252, 251, 0.92);
  border-right-color: rgba(54, 80, 68, 0.08);
}

body[data-theme="dark"] .sidebar-collapse-btn {
  background: rgba(18, 27, 22, 0.56);
  border-color: rgba(183, 210, 194, 0.18);
}

body[data-theme="light"] .sidebar-collapse-btn {
  background: rgba(245, 248, 246, 0.96);
  border-color: rgba(76, 107, 92, 0.16);
}

body[data-theme="dark"] .backdrop,
body[data-theme="dark"] .modal-content,
body[data-theme="light"] .modal-content {
  backdrop-filter: blur(18px);
}

body[data-theme="dark"] .agent-card.rodrigo,
body[data-theme="light"] .agent-card.rodrigo {
  --agent-color: var(--fc-accent);
}

body[data-theme="dark"] .agent-card.helios,
body[data-theme="light"] .agent-card.helios {
  --agent-color: var(--fc-highlight);
}

body[data-theme="dark"] .live-badge,
body[data-theme="light"] .live-badge {
  background: var(--fc-accent-wash);
  border-color: rgba(118, 182, 155, 0.34);
}

body[data-theme="dark"] .history-item.activity,
body[data-theme="light"] .history-item.activity,
body[data-theme="dark"] .recent-activity-item.activity,
body[data-theme="light"] .recent-activity-item.activity {
  border-color: rgba(118, 182, 155, 0.32);
}

body[data-theme="dark"] .history-item.delegation,
body[data-theme="light"] .history-item.delegation,
body[data-theme="dark"] .recent-activity-item.delegation,
body[data-theme="light"] .recent-activity-item.delegation {
  border-color: rgba(147, 66, 80, 0.34);
}


body[data-theme="dark"] .login-card,
body[data-theme="dark"] .admin-section,
body[data-theme="dark"] .admin-sidebar,
body[data-theme="dark"] .admin-mini-card,
body[data-theme="dark"] .admin-health-item,
body[data-theme="dark"] .admin-cron-item,
body[data-theme="dark"] .admin-user-card,
body[data-theme="dark"] .quick-note-card,
body[data-theme="dark"] .admin-modal-content,
body[data-theme="dark"] .admin-notification {
  background: var(--fc-surface-dark-strong);
  border-color: var(--fc-border-dark);
  box-shadow: var(--fc-shadow-dark);
}

body[data-theme="light"] .login-card,
body[data-theme="light"] .admin-section,
body[data-theme="light"] .admin-sidebar,
body[data-theme="light"] .admin-mini-card,
body[data-theme="light"] .admin-health-item,
body[data-theme="light"] .admin-cron-item,
body[data-theme="light"] .admin-user-card,
body[data-theme="light"] .quick-note-card,
body[data-theme="light"] .admin-modal-content,
body[data-theme="light"] .admin-notification {
  background: var(--fc-surface-light);
  border-color: var(--fc-border-light);
  box-shadow: var(--fc-shadow-light);
}

body[data-theme="dark"] :is(.admin-sidebar-btn.active, .admin-btn-primary, .login-submit),
body[data-theme="light"] :is(.admin-sidebar-btn.active, .admin-btn-primary, .login-submit) {
  background: linear-gradient(135deg, rgba(77, 139, 114, 0.34), rgba(118, 182, 155, 0.18));
  border-color: rgba(118, 182, 155, 0.4);
  color: var(--fc-accent-soft);
}

body[data-theme="light"] :is(.admin-sidebar-btn.active, .admin-btn-primary, .login-submit) {
  color: var(--fc-accent-strong);
}

body[data-theme="dark"] :is(.admin-btn-secondary, .admin-input, .admin-select, .login-input, .password-toggle, .admin-modal-close),
body[data-theme="light"] :is(.admin-btn-secondary, .admin-input, .admin-select, .login-input, .password-toggle, .admin-modal-close) {
  background: color-mix(in srgb, var(--fc-surface-dark-strong) 88%, transparent);
  border-color: var(--fc-border-dark-strong);
  color: inherit;
}

body[data-theme="light"] :is(.admin-btn-secondary, .admin-input, .admin-select, .login-input, .password-toggle, .admin-modal-close) {
  background: color-mix(in srgb, var(--fc-surface-light-strong) 96%, transparent);
  border-color: var(--fc-border-light-strong);
}

body[data-theme="dark"] :is(.admin-btn:hover, .admin-sidebar-btn:hover, .login-submit:hover, .password-toggle:hover, .admin-modal-close:hover),
body[data-theme="light"] :is(.admin-btn:hover, .admin-sidebar-btn:hover, .login-submit:hover, .password-toggle:hover, .admin-modal-close:hover) {
  border-color: rgba(147, 66, 80, 0.5);
  background: var(--fc-highlight-wash);
  color: var(--fc-highlight-soft);
}

body[data-theme="light"] :is(.admin-btn:hover, .admin-sidebar-btn:hover, .login-submit:hover, .password-toggle:hover, .admin-modal-close:hover) {
  color: var(--fc-highlight);
}

body[data-theme="dark"] .admin-user-card.current-user,
body[data-theme="light"] .admin-user-card.current-user,
body[data-theme="dark"] .quick-note-card.pinned,
body[data-theme="light"] .quick-note-card.pinned {
  border-color: rgba(118, 182, 155, 0.42);
  box-shadow: 0 12px 24px rgba(60, 98, 80, 0.14);
}

body[data-theme="dark"] .role-badge.admin,
body[data-theme="light"] .role-badge.admin {
  background: rgba(147, 66, 80, 0.18);
  border-color: rgba(147, 66, 80, 0.34);
  color: var(--fc-highlight-soft);
}

body[data-theme="light"] .role-badge.admin {
  color: var(--fc-highlight);
}

body[data-theme="dark"] .role-badge.user,
body[data-theme="light"] .role-badge.user {
  background: rgba(118, 182, 155, 0.16);
  border-color: rgba(118, 182, 155, 0.34);
  color: var(--fc-accent-soft);
}

body[data-theme="light"] .role-badge.user {
  color: var(--fc-accent-strong);
}
