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

html {
  scroll-behavior: smooth;
}

:root {
  /* Flat pastel palette — sampled directly from a pastel calculator's keys.
     No gradients anywhere; every color below is a flat solid fill. */
  --primary:       #c9b8e8;   /* lavender key (1 2 3 −) */
  --primary-dark:  #ad95d9;   /* pressed/hover shade */
  --primary-light: #f2edfa;
  --primary-soft:  #ddd0f0;
  --success:       #c7e3a3;   /* sage-green key (MRC M- M+ →) */
  --success-dark:  #aacd7c;
  --done-green:    #22c55e;   /* vivid green reserved for completed/tick-mark states */
  --warning:       #f3e29b;   /* cream-yellow key (7 8 9 ÷) */
  --warning-dark:  #e8ce6e;
  --danger:        #f0906a;   /* coral-orange key (CE AC) */
  --danger-dark:   #e17750;

  /* Dark "ink" shades — used only for text/icons so they stay readable
     on top of the pale pastel fills above (never used as a background). */
  --primary-ink:   #6b4fa8;
  --success-ink:   #4d8b3a;
  --warning-ink:   #96751b;
  --danger-ink:    #c1502f;
  --blue-ink:      #2b8aad;
  --pink-ink:      #c15a7a;
  --text:          #33475b;
  --text-muted:    #7a8699;
  --border:        #d9d4e8;
  --bg:            #eaf6fa;   /* pastel sky-blue — the calculator's case color */
  --white:         #ffffff;

  /* Extra flat pastel accents (candy keys) */
  --accent-pink:   #f3b6c6;   /* rose key (4 5 6 × √ % MU) */
  --accent-yellow: #f3e29b;
  --accent-blue:   #aee3f0;   /* sky-blue key/case */
  --accent-green:  #c7e3a3;
  --accent-orange: #f0906a;
  --accent-purple: #c9b8e8;
  --sidebar-w:     64px;
  --sidebar-w-expanded: 260px;
  /* Smooth transitions */
  --ease-out:      cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-in-out:   cubic-bezier(0.4, 0, 0.2, 1);
  --duration:      0.25s;
  --duration-slow: 0.35s;

  /* Sidebar — tinted like the calculator's case, not white */
  --sidebar-bg:        #d9f0f6;
  --sidebar-bg-hover:  #c7e8f0;
  --sidebar-bg-active: #b8dfe9;
  --sidebar-text:      #33475b;
  --sidebar-text-dim:  #3d5064;
  --sidebar-year:      #3d5064;
  --sidebar-border:    #c2e4ed;

  /* Category flat pastel colors — same key palette, cycled */
  --cat-LinkedIn:  #aee3f0;
  --cat-Email:     #f3e29b;
  --cat-Calls:     #f3b6c6;
  --cat-Outreach:  #c7e3a3;
  --cat-Content:   #f0906a;
  --cat-Network:   #aee3f0;
  --cat-Learning:  #c9b8e8;
  --cat-Health:    #c7e3a3;
  --cat-Sales:     #f0906a;
  --cat-Sleep:     #c9b8e8;
  --cat-Planning:  #f3e29b;
  --cat-default:   #d9f0f6;
}

body {
  font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ===========================
   SIDEBAR
=========================== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
  border-right: 1px solid var(--sidebar-border);
  box-shadow: 1px 0 0 0 var(--sidebar-border);
  overflow: hidden;
  transition: width 0.25s var(--ease-in-out);
}

.sidebar:hover {
  width: var(--sidebar-w-expanded);
  box-shadow: 4px 0 20px rgba(15,23,42,0.08);
}

.sidebar-logo {
  padding: 20px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-start;
  overflow: hidden;
  white-space: nowrap;
}

.logo-icon {
  font-size: 28px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon svg {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  color: var(--primary-ink);
}

.logo-text {
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.15s ease;
  min-width: 0;
}

.sidebar:hover .logo-text {
  opacity: 1;
}

.logo-text h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--sidebar-text);
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.logo-text span {
  font-size: 12px;
  color: var(--sidebar-year);
  font-weight: 500;
  margin-top: 2px;
  display: block;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 10px;
  color: var(--sidebar-text-dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease, padding 0.25s var(--ease-in-out);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar:hover .sidebar-nav a {
  padding: 12px 14px;
}

.sidebar-nav a span:not(.nav-icon) {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.sidebar:hover .sidebar-nav a span:not(.nav-icon) {
  opacity: 1;
}

.sidebar-nav a .nav-icon {
  font-size: 18px;
  width: 24px;
  min-width: 24px;
  height: 24px;
  text-align: center;
  line-height: 1;
  opacity: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-nav a .nav-icon svg {
  width: 22px;
  height: 22px;
  color: currentColor;
}

.sidebar-nav a:hover {
  background: var(--sidebar-bg-hover);
  color: var(--sidebar-text);
}

.sidebar-nav a:hover .nav-icon { opacity: 1; }

.sidebar-nav a.active {
  background: var(--sidebar-bg-active);
  color: var(--primary-ink);
  font-weight: 600;
}

.sidebar-nav a.active .nav-icon { opacity: 1; }

.sidebar-nav a:focus-visible,
.btn-sidebar-logout:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.sidebar-footer {
  padding: 12px 0;
  border-top: 1px solid var(--sidebar-border);
  background: var(--bg);
  overflow: hidden;
  white-space: nowrap;
  transition: padding 0.25s var(--ease-in-out);
}

.sidebar:hover .sidebar-footer {
  padding: 16px 16px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding: 10px 13px;
  border-radius: 0;
  background: var(--sidebar-bg);
  border: none;
  border-bottom: 1px solid var(--sidebar-border);
  justify-content: center;
  transition: padding 0.25s var(--ease-in-out), border-radius 0.25s ease;
}

.sidebar:hover .sidebar-user {
  justify-content: flex-start;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--sidebar-border);
  margin: 0 0 8px 0;
}

.sidebar-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--sidebar-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.sidebar:hover .sidebar-user-name {
  opacity: 1;
}

.btn-sidebar-logout {
  width: 100%;
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  color: var(--sidebar-text-dim);
  border: none;
  border-radius: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, padding 0.25s var(--ease-in-out), border-radius 0.25s ease;
  font-family: inherit;
}

.sidebar:hover .btn-sidebar-logout {
  padding: 10px 14px;
  background: var(--white);
  border: 1px solid var(--sidebar-border);
  border-radius: 10px;
}

.btn-sidebar-logout:hover {
  background: var(--sidebar-bg-hover);
  color: var(--text);
  border-color: var(--border);
}

.btn-sidebar-logout .logout-icon {
  width: 16px;
  height: 16px;
  color: var(--sidebar-text-dim);
  flex-shrink: 0;
}

.btn-sidebar-logout .logout-text {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  transition: opacity 0.2s ease, max-width 0.25s var(--ease-in-out);
}

.sidebar:hover .btn-sidebar-logout .logout-text {
  opacity: 1;
  max-width: 120px;
}

/* ===========================
   MAIN
=========================== */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  overflow-x: auto;
}

.page-header {
  background: var(--sidebar-bg);
  color: var(--text);
  padding: 0 28px;
  height: 81px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.page-header h1 {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.page-header h1 .page-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--primary-ink);
}

.page-header h1 .page-title-icon svg {
  width: 24px;
  height: 24px;
}

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

.year-badge {
  background: var(--white);
  color: var(--primary-ink);
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  letter-spacing: 0.01em;
}

.page-content {
  padding: 28px 28px;
  flex: 1;
  background: var(--bg);
  min-width: 0;
}

/* ===========================
   STAT CARDS
=========================== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
  align-items: stretch;
}

@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
}

.stat-card {
  background: #c9edf5;
  border-radius: 14px;
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid transparent;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: box-shadow 0.25s ease, transform 0.2s ease;
}
.stat-card:focus-within { outline: none; box-shadow: 0 0 0 2px var(--primary-soft); }

.stat-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.stat-card.green  { background: #dbedc4; }
.stat-card.orange { background: #f7ecc0; }
.stat-card.red    { background: #f6c9b4; }
.stat-card.purple { background: #ddd2f0; }

.stat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.stat-icon {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: rgba(255,255,255,0.55);
  box-shadow: 0 1px 2px rgba(15,23,42,0.06);
}
.stat-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}
.stat-icon-blue   { color: var(--blue-ink); }
.stat-icon-green  { color: var(--success-ink); }
.stat-icon-orange { color: var(--warning-ink); }
.stat-icon-purple { color: var(--primary-ink); }

.stat-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text);
}
.stat-subtitle {
  font-size: 11px;
  color: var(--text);
  opacity: 1;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: -0.02em;
}

.stat-value.blue   { color: var(--blue-ink); }
.stat-value.green  { color: var(--success-ink); }
.stat-value.orange { color: var(--warning-ink); }
.stat-value.red    { color: var(--danger-ink); }
.stat-card.purple .stat-value { color: var(--primary-ink); }

/* ===========================
   TODAY FOCUS
=========================== */
.today-focus {
  background: var(--primary);
  color: var(--text);
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 24px;
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 0;
  box-shadow: 0 8px 32px rgba(108,92,231,0.25), 0 2px 8px rgba(0,0,0,0.06);
  position: relative;
  overflow: hidden;
}

.today-focus h3 {
  font-size: 14px;
  font-weight: 600;
  opacity: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 18px;
  letter-spacing: 0.02em;
}
.today-focus h3 .focus-icon {
  opacity: 1;
  font-size: 18px;
}
.today-focus h3 .focus-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.today-stat {
  text-align: center;
  flex: 1;
  min-width: 88px;
  padding: 4px 12px 8px;
  border-left: 1px solid rgba(51,71,91,0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.today-stat:first-of-type { border-left: none; padding-left: 0; }

.today-stat .t-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 1;
  margin-bottom: 4px;
  font-weight: 600;
}

.today-stat .t-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* Add subtle separators under Today's Focus values for better alignment */
.today-stat .t-value::after {
  content: '';
  display: block;
  margin-top: 4px;
  width: 24px;
  height: 2px;
  border-radius: 999px;
  background: rgba(51,71,91,0.25);
}

/* Today Focus – mobile layout */
@media (max-width: 600px) {
  .today-focus {
    padding: 18px 16px 16px;
    flex-direction: row;
    align-items: flex-start;
    border-radius: 20px;
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .today-focus h3 {
    margin-bottom: 8px;
    font-size: 13px;
    width: 100%;
  }

  .today-stat {
    border-left: none;
    padding: 6px 4px 8px;
    align-items: flex-start;
    text-align: left;
    flex: 0 0 50%;
    max-width: 50%;
  }

  .today-stat .t-label {
    font-size: 10px;
  }

  .today-stat .t-value {
    font-size: 18px;
  }

  .today-stat .t-value::after {
    width: 18px;
    margin-top: 3px;
  }
}

/* ===========================
   SECTION CARD
=========================== */
.section-card {
  background: var(--bg);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  margin-bottom: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.section-card-header {
  background: var(--primary-light);
  color: var(--primary-ink);
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

.section-card-title { flex: 1; }
.section-card-meta {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  opacity: 1;
}
.section-card-meta strong { color: var(--primary-ink); }

/* ===========================
   TABLES
=========================== */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: var(--bg);
  color: var(--text-muted);
  padding: 12px 16px;
  text-align: center;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

thead th:first-child { text-align: left; }

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.2s ease;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--primary-light) !important; }

tbody td {
  padding: 14px 16px;
  text-align: center;
  color: var(--text);
  white-space: nowrap;
}

tbody td:first-child {
  text-align: left;
  font-weight: 600;
}

.year-total-row td {
  background: var(--primary-light) !important;
  font-weight: 700;
  color: var(--primary-ink);
  border-top: 2px solid var(--primary-soft);
}

/* ===== Year Overview table – improved UI ===== */
.dashboard-table thead th {
  background: #f7b89b;
  padding: 12px 14px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--danger-ink);
  border-bottom: none;
}
.dashboard-table thead th.col-sr { text-align: center; }
.dashboard-table thead th:not(.col-sr):not(:nth-child(2)) { text-align: right; }

.dashboard-table tbody td {
  padding: 12px 14px;
  vertical-align: middle;
}
.dashboard-table .col-sr {
  width: 1%;
  min-width: 48px;
  text-align: center;
  white-space: nowrap;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
}
.dashboard-table tbody td.col-sr { color: var(--text); font-weight: 500; }
.dashboard-table .year-total-row td.col-sr { color: var(--primary-ink); }

.dashboard-table .col-month {
  text-align: center;
  min-width: 140px;
}
.dashboard-table .col-month .month-name { font-weight: 600; color: var(--text); }
.dashboard-table .col-month .current-month-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--primary);
  color: var(--text);
  vertical-align: middle;
}
.dashboard-table .col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  min-width: 64px;
}
.dashboard-table .col-tasks {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.dashboard-table .col-progress {
  min-width: 100px;
  text-align: right;
}

/* Progress bar in cell */
.dashboard-table .progress-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.dashboard-table .progress-bar {
  width: 56px;
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
}
.dashboard-table .progress-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--success);
  transition: width 0.25s ease;
}
.dashboard-table .progress-pct {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  min-width: 36px;
  text-align: right;
}

/* Current month row highlight */
.dashboard-table tbody tr.row-current-month {
  background: var(--warning) !important;
  border-left: 4px solid var(--warning-dark);
  font-weight: 600;
}
.dashboard-table tbody tr.row-current-month:hover {
  background: var(--warning-dark) !important;
}

/* Rotating pastel fill per month row (except current month and year total) */
.dashboard-table tbody tr.year-row:not(.row-current-month):nth-child(5n+1) { background: rgba(174, 227, 240, 0.45); }
.dashboard-table tbody tr.year-row:not(.row-current-month):nth-child(5n+2) { background: rgba(243, 182, 198, 0.4); }
.dashboard-table tbody tr.year-row:not(.row-current-month):nth-child(5n+3) { background: rgba(199, 227, 163, 0.4); }
.dashboard-table tbody tr.year-row:not(.row-current-month):nth-child(5n+4) { background: rgba(201, 184, 232, 0.35); }
.dashboard-table tbody tr.year-row:not(.row-current-month):nth-child(5n+5) { background: rgba(243, 226, 155, 0.4); }

.dashboard-table tbody tr.year-row:hover {
  background: var(--primary-soft) !important;
}
.dashboard-table tbody tr.row-current-month:hover {
  background: var(--warning-dark) !important;
}

.dashboard-table .year-total-row td:nth-child(2) { text-align: center; font-weight: 700; }

/* Score colors – clearer hierarchy */
.dashboard-table .score-high { color: var(--success-ink); font-weight: 700; }
.dashboard-table .score-mid  { color: var(--warning-ink); font-weight: 600; }
.dashboard-table .score-low  { color: var(--danger-ink);  font-weight: 600; }
.dashboard-table .score-zero { color: var(--text); font-weight: 600; }

/* Table loading / empty / error cells */
.loading-cell,
.empty-cell,
.error-cell {
  text-align: center !important;
  padding: 32px 24px !important;
  vertical-align: middle !important;
  text-align: center !important;
}
.loading-cell { color: var(--text-muted); font-size: 14px; text-align: center !important; }

.table-empty-state,
.table-error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 360px;
  margin: 0 auto;
}
.table-empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.85;
  line-height: 1;
}
.table-empty-state strong,
.table-error-state strong {
  display: block;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 6px;
}
.table-empty-state p,
.table-error-state p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}
.table-empty-state a {
  color: var(--primary-ink);
  font-weight: 600;
  text-decoration: none;
}
.table-empty-state a:hover { text-decoration: underline; }
.table-error-state strong { color: var(--danger-ink); }
.table-error-state p code {
  background: rgba(240,144,106,0.18);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--danger-ink);
}

/* Category row bg */
tr[data-cat="LinkedIn"] { background: var(--cat-LinkedIn); }
tr[data-cat="Email"]    { background: var(--cat-Email); }
tr[data-cat="Calls"]    { background: var(--cat-Calls); }
tr[data-cat="Outreach"] { background: var(--cat-Outreach); }
tr[data-cat="Content"]  { background: var(--cat-Content); }
tr[data-cat="Network"]  { background: var(--cat-Network); }
tr[data-cat="Learning"] { background: var(--cat-Learning); }
tr[data-cat="Health"]   { background: var(--cat-Health); }
tr[data-cat="Sales"]    { background: var(--cat-Sales); }
tr[data-cat="Sleep"]    { background: var(--cat-Sleep); }
tr[data-cat="Planning"] { background: var(--cat-Planning); }

/* Score colors */
.score-high { color: var(--success-ink); font-weight: 700; }
.score-mid  { color: var(--warning-ink); font-weight: 600; }
.score-low  { color: var(--danger-ink);  font-weight: 600; }
.score-zero { color: var(--text); font-weight: 600; }

/* ===========================
   CHARTS
=========================== */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
  align-items: start;
}

@media (max-width: 768px) {
  .charts-row { grid-template-columns: 1fr; }
}

.chart-card {
  background: var(--bg);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  overflow: hidden;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
}
.chart-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  border-color: var(--primary-soft);
}

.chart-card .chart-area {
  position: relative;
  height: 280px;
  padding: 12px 14px 14px;
}
.chart-card canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.chart-empty-state {
  position: absolute;
  inset: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 24px;
}
.chart-empty-state .chart-empty-icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.7;
}
.chart-empty-state .chart-empty-icon svg {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  stroke: currentColor;
}
.chart-empty-state strong {
  display: block;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 6px;
}
.chart-empty-state p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

/* ===========================
   BUTTONS
=========================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background var(--duration) var(--ease-out), color var(--duration) var(--ease-out), border-color var(--duration) var(--ease-out), transform var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out);
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-outline:disabled,
.btn-outline[disabled] {
  background: #f9fafb;
  color: var(--text-muted);
  border-color: var(--border);
}


.btn-primary { background: var(--primary); color: var(--text); }
.btn-primary:hover { background: var(--primary-dark); }

.btn-success { background: var(--success); color: var(--text); }
.btn-success:hover { background: var(--success-dark); }

.btn-danger  { background: var(--danger); color: var(--text); }
.btn-danger:hover { background: var(--danger-dark); }

.btn-outline { background: var(--primary-light); color: var(--text); border: 1.5px solid var(--primary-soft); }
.btn-outline:hover { background: var(--primary-soft); border-color: var(--primary); }

.btn-ghost { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-sm   { padding: 5px 11px; font-size: 12px; }
.btn-icon { padding: 5px 8px; }

/* ===========================
   FORMS
=========================== */
input[type="text"],
input[type="number"],
input[type="date"],
select {
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out);
}

input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(45,90,160,0.1);
}

/* ===========================
   TOGGLE
=========================== */
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #ccc;
  border-radius: 22px;
  transition: 0.25s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.25s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle input:checked + .toggle-slider { background: var(--success); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ===========================
   CATEGORY BADGE
=========================== */
.cat-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary-ink);
}

/* ===========================
   SETUP PAGE — ENHANCED UI
=========================== */
/* Subtle background for setup content */
.main:has(.page-content) .page-content {
  background: var(--bg);
  position: relative;
}

/* Toolbar — card with soft shadow and accent */
.pro-toolbar {
  background: var(--primary-light);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  transition: box-shadow var(--duration) var(--ease-out);
}
.pro-toolbar:hover {
  box-shadow: 0 4px 16px rgba(79,70,229,0.08), 0 2px 6px rgba(0,0,0,0.04);
}
.pro-toolbar .toolbar-hint {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--primary-light);
  border-radius: 10px;
  border: 1px solid var(--primary-soft);
}
.pro-toolbar .toolbar-hint svg {
  color: var(--primary-ink);
  opacity: 1;
  flex-shrink: 0;
}
.pro-toolbar-left {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.pro-toolbar .btn-primary svg {
  margin-right: 6px;
  vertical-align: -2px;
}

/* Add Task button — primary CTA */
.pro-toolbar .btn-primary,
.setup-add-btn {
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(79,70,229,0.25);
  transition: transform var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out);
}
.pro-toolbar .btn-primary:hover,
.setup-add-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(79,70,229,0.35);
}

/* Section card — elevated, flat header fill */
.pro-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  margin-bottom: 24px;
  overflow: hidden;
  transition: box-shadow var(--duration) var(--ease-out);
}
.pro-section:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.06), 0 2px 8px rgba(79,70,229,0.06);
}
.pro-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--primary-light);
  color: var(--primary-ink);
  border-bottom: 1px solid var(--border);
}
.pro-section-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary-ink);
}
.pro-section-title svg {
  opacity: 0.9;
  flex-shrink: 0;
}
.pro-count-pill {
  background: var(--primary);
  color: var(--text);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(108,92,231,0.25);
  letter-spacing: 0.02em;
}

/* Setup table — cleaner and more spacious */
.pro-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed; /* keep Daily/Weekly/Monthly columns perfectly aligned */
}
.pro-table thead th {
  background: var(--bg);
  color: var(--text-muted);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 14px 18px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.pro-table thead th:nth-child(2) { text-align: left; } /* Task Name header */
.pro-table .sr-no-col { width: 1%; white-space: nowrap; text-align: center; min-width: 56px; }
.pro-table tbody td:nth-child(2) { text-align: left; } /* Task name column */
.pro-table thead th:nth-child(1),
.pro-table tbody td:nth-child(1) { width: 7%; }
.pro-table thead th:nth-child(2),
.pro-table tbody td:nth-child(2) { width: 42%; }
.pro-table thead th:nth-child(3),
.pro-table tbody td:nth-child(3) { width: 16%; }
.pro-table thead th:nth-child(4),
.pro-table tbody td:nth-child(4) { width: 12%; }
.pro-table thead th:nth-child(5),
.pro-table tbody td:nth-child(5) { width: 11%; }
.pro-table thead th:nth-child(6),
.pro-table tbody td:nth-child(6) { width: 12%; }
.pro-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.2s ease, transform 0.05s ease, box-shadow 0.2s ease;
}
.pro-table tbody tr:last-child { border-bottom: none; }
.pro-table tbody tr:nth-child(even) { background: rgba(174,227,240,0.2); }
.pro-table tbody tr:hover {
  background: var(--primary-light) !important;
  box-shadow: inset 0 0 0 1px rgba(108,92,231,0.15);
}
.pro-table tbody td {
  padding: 8px 18px;
  text-align: center;
  vertical-align: middle;
  color: var(--text);
}
.pro-table tbody td:first-child { text-align: center; } /* Sr No */
.pro-task-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  letter-spacing: -0.01em;
  text-align: left;
}
.pro-task-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: left;
}
.pro-type-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg);
  color: var(--text-muted);
  text-transform: capitalize;
  border: 1px solid var(--border);
}
.pro-action-btn {
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.pro-action-btn.pro-btn-icon {
  padding: 8px;
  min-width: 38px;
  min-height: 38px;
}
.pro-action-btn .btn-icon { width: 16px; height: 16px; min-width: 16px; min-height: 16px; flex-shrink: 0; display: block; }
.pro-action-btn .btn-emoji { font-size: 16px; line-height: 1; display: inline-block; }
.pro-btn-edit {
  background: var(--primary-light);
  color: var(--primary-ink);
  border: 1px solid var(--primary-soft);
}
.pro-btn-edit:hover {
  background: var(--primary-soft);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108,92,231,0.2);
}
.pro-btn-del {
  background: #fce4da;
  color: var(--danger-ink);
  border: 1px solid #f5c7b3;
}
.pro-btn-del:hover {
  background: #f8d2bf;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(240,144,106,0.3);
}
.pro-action-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.pro-btn-del:focus-visible { outline-color: var(--danger); }

/* Category pill (used inline in setup.js — keep global pill look) */
.pro-cat-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.pro-weight-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ===========================
   SETUP TABLE (legacy)
=========================== */
.setup-table input, .setup-table select {
  width: 100%;
  padding: 5px 8px;
  font-size: 12px;
}

.setup-table td { padding: 7px 10px; vertical-align: middle; }
.setup-table td:first-child { text-align: left; }

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

/* ===========================
   TASK TRACKER
=========================== */
.tracker-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.live-score-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--primary-light);
  color: var(--primary-ink);
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--primary-soft);
}

.score-bar-wrap {
  background: rgba(255,255,255,0.25);
  border-radius: 10px;
  height: 7px;
  width: 100px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 10px;
  background: #fff;
  transition: width 0.4s ease;
}

/* Checkbox */
.task-checkbox {
  width: 20px; height: 20px;
  cursor: pointer;
  accent-color: var(--success);
}

tbody tr.completed td { opacity: 0.6; }
tbody tr.completed .task-name { text-decoration: line-through; }

/* Tab bar */
.tab-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  background: var(--bg);
  padding: 6px;
  border-radius: 12px;
  width: fit-content;
  border: 1px solid var(--border);
}

.tab-btn {
  padding: 10px 20px;
  border-radius: 10px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.tab-btn.active { background: var(--white); color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,0.06); border: 1px solid var(--border); }
.tab-btn:hover:not(.active) { background: var(--white); color: var(--text); }

/* ===========================
   MODAL
=========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--white);
  border-radius: 16px;
  padding: 0;
  width: 480px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.04);
  animation: modalIn 0.25s ease;
}

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

.modal-header {
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px 0;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-title-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--text);
}
.modal-title-icon svg { display: block; }

.modal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.45;
}

.modal-body {
  padding: 20px 24px 24px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.modal-section {
  margin-bottom: 18px;
}

.modal-section:last-child { margin-bottom: 0; }

.modal-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 0 0 10px 0;
}

.modal-section-active {
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--border);
}

.modal-field { margin-bottom: 12px; }
.modal-field:last-child { margin-bottom: 0; }
.modal-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.modal-field .required { color: var(--danger-ink); }

.modal-field input,
.modal-field select {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.modal-field input:focus,
.modal-field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.modal-field input::placeholder { color: var(--text-muted); opacity: 0.8; }

.modal-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin: 4px 0 0 0;
  line-height: 1.4;
}

.modal-hint-inline { margin-top: 6px; margin-bottom: 0; }

.modal-row {
  display: grid;
  gap: 12px;
}

.modal-row-2 { grid-template-columns: 1fr 1fr; }
.modal-row-3 { grid-template-columns: 1fr 1fr 1fr; }

.modal-type-options {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.modal-type-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-type-option:hover { border-color: var(--primary-soft); background: var(--primary-light); }
.modal-type-option input { display: none; }
.modal-type-option input:checked + .modal-type-label { font-weight: 700; color: var(--primary-ink); }
.modal-type-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
}

.modal-type-label { font-size: 13px; font-weight: 500; color: var(--text); }

.modal-field-inline {
  display: flex;
  align-items: center;
  gap: 12px;
}
.modal-field-inline > label { margin-bottom: 0; }

.category-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 1000;
  max-height: 180px;
  overflow-y: auto;
  margin-top: 4px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 24px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  border-radius: 0 0 16px 16px;
  flex-shrink: 0;
}

.modal-actions .btn-save { min-width: 120px; }
.modal-actions .btn-save-icon {
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
}
.modal-actions .btn-save-icon svg { flex-shrink: 0; }

/* ===========================
   TOAST
=========================== */
.toast-container {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.toast {
  background: #fff;
  color: #1e293b;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.13);
  border: 1px solid #e2e8f0;
  animation: toastIn 0.2s ease;
  min-width: 260px;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.toast .toast-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast .toast-msg {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
}

.toast.success .toast-icon { background: #dcfce7; }
.toast.error   .toast-icon { background: #fee2e2; }
.toast.info    .toast-icon { background: #dbeafe; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ===========================
   SKELETON LOADING (matches card layout)
=========================== */
.skeleton-view { display: block; }
.skeleton-view.hidden { display: none !important; }

.skeleton-line {
  background: linear-gradient(
    90deg,
    var(--border) 0%,
    var(--bg) 45%,
    var(--border) 90%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
  border-radius: 6px;
  min-height: 1em;
  display: inline-block;
  vertical-align: middle;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Stat card skeleton – same card, shimmer inside */
#dashboardSkeleton .stat-card.skeleton-card .stat-label,
#dashboardSkeleton .stat-card.skeleton-card .stat-value { color: transparent; }
#dashboardSkeleton .skeleton-label { width: 70px; min-height: 12px; display: block; }
#dashboardSkeleton .skeleton-value { width: 48px; min-height: 28px; display: block; margin-top: 2px; }

/* Today's Focus skeleton – same banner, light shimmer on gradient */
#dashboardSkeleton .today-focus.skeleton-focus .skeleton-line {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.35) 0%,
    rgba(255,255,255,0.15) 45%,
    rgba(255,255,255,0.35) 90%
  );
  background-size: 200% 100%;
}
#dashboardSkeleton .skeleton-focus-title { width: 140px; min-height: 16px; display: block; margin-bottom: 4px; }
#dashboardSkeleton .skeleton-stat-label { width: 60px; min-height: 10px; display: block; margin: 0 auto 4px; }
#dashboardSkeleton .skeleton-stat-value { width: 44px; min-height: 20px; display: block; margin: 0 auto; }

/* Chart card skeleton – same chart-card layout */
#dashboardSkeleton .chart-card.skeleton-chart-card .section-card-header { color: transparent; }
#dashboardSkeleton .skeleton-header { width: 160px; min-height: 16px; display: inline-block; }
#dashboardSkeleton .skeleton-header-sm { width: 90px; min-height: 12px; display: inline-block; margin-left: 8px; }
#dashboardSkeleton .skeleton-chart-area {
  display: block;
  min-height: 210px;
  margin: 12px 14px 14px;
  border-radius: 8px;
}

/* Table skeleton – same section-card + cells */
#dashboardSkeleton .skeleton-table-row td { padding: 12px 16px; vertical-align: middle; }
#dashboardSkeleton .skeleton-cell { height: 14px; max-width: 52px; margin: 0 auto; display: block; }
#dashboardSkeleton .skeleton-table-row td:first-child .skeleton-cell { max-width: 72px; margin-left: 0; }

/* Show skeleton, hide only real content (siblings after #dashboardSkeleton) when loading */
.page-content.loading #dashboardSkeleton { display: block; }
.page-content.loading #dashboardSkeleton ~ .stats-row,
.page-content.loading #dashboardSkeleton ~ .today-focus,
.page-content.loading #dashboardSkeleton ~ .charts-row,
.page-content.loading #dashboardSkeleton ~ .section-card { display: none !important; }
#dashboardSkeleton { display: none; }

/* Setup page skeleton */
#setupSkeleton { display: none; }
.page-content.loading #setupSkeleton { display: block; }
.page-content.loading #setupSkeleton ~ .pro-toolbar,
.page-content.loading #setupSkeleton ~ .pro-section { display: none !important; }

#setupSkeleton .pro-section { pointer-events: none; }
#setupSkeleton .skeleton-table-row td { padding: 12px 16px; vertical-align: middle; }
#setupSkeleton .skeleton-cell { height: 14px; max-width: 40px; margin: 0 auto; display: block; border-radius: 6px; }
#setupSkeleton .skeleton-task-name { max-width: 180px; margin: 0; height: 16px; }
#setupSkeleton .skeleton-pill { max-width: 72px; border-radius: 20px; margin: 0 auto; }
#setupSkeleton .skeleton-circle { width: 26px; height: 26px; border-radius: 50%; margin: 0 auto; max-width: none; }
#setupSkeleton .skeleton-toggle { width: 44px; height: 24px; border-radius: 12px; margin: 0 auto; display: block; }
#setupSkeleton .skeleton-btn-sm { width: 52px; height: 28px; border-radius: 8px; display: inline-block; }
#setupSkeleton .setup-skeleton-toolbar .skeleton-line { margin: 0; }

/* Monthly Task Tracker skeleton */
/* Default: show skeleton until real content is ready */
#monthlySkeleton { display: block; }

/* When loading, show only skeleton (hide real content) */
.page-content.loading #monthlySkeleton { display: block; }
.page-content.loading #monthlySkeleton ~ .stats-row,
.page-content.loading #monthlySkeleton ~ .heatmap-controls,
.page-content.loading #monthlySkeleton ~ .heatmap-wrap,
.page-content.loading #monthlySkeleton ~ .extra-tasks-section,
.page-content.loading #monthlySkeleton ~ .heatmap-legend { display: none !important; }

/* Once loading finished, hide skeleton */
.page-content:not(.loading) #monthlySkeleton { display: none; }

/* Stats row – match real card size */
#monthlySkeleton .stat-card.skeleton-card .stat-label,
#monthlySkeleton .stat-card.skeleton-card .stat-value { color: transparent; }
#monthlySkeleton .skeleton-label { width: 72px; min-height: 12px; display: block; }
#monthlySkeleton .skeleton-value { width: 52px; min-height: 22px; display: block; margin-top: 4px; }

/* Controls – same layout as Prev / Month / Year / Next + This Month */
#monthlySkeleton .heatmap-controls.monthly-skeleton-controls {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
#monthlySkeleton .skeleton-controls-left {
  display: flex; align-items: center; gap: 8px;
}
#monthlySkeleton .skeleton-btn { width: 64px; height: 32px; border-radius: 8px; display: block; }
#monthlySkeleton .skeleton-select { width: 96px; height: 32px; border-radius: 8px; display: block; }
#monthlySkeleton .skeleton-select-sm { width: 68px; height: 32px; border-radius: 8px; display: block; }
#monthlySkeleton .skeleton-controls-right {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
#monthlySkeleton .skeleton-btn-sm { width: 92px; height: 28px; border-radius: 7px; display: block; }
#monthlySkeleton .skeleton-range-label { width: 110px; height: 18px; border-radius: 999px; display: block; }
#monthlySkeleton .skeleton-btn-primary { width: 96px; height: 32px; border-radius: 8px; display: block; }

/* Heatmap table – match real column widths and row height */
#monthlySkeleton .heatmap-wrap { pointer-events: none; }
#monthlySkeleton .skeleton-heatmap-table { min-width: 100%; }
#monthlySkeleton .skeleton-heatmap-table thead th.task-col {
  min-width: 200px; max-width: 240px; padding: 12px 16px; text-align: left;
}
#monthlySkeleton .skeleton-heatmap-table thead th.date-header-cell {
  min-width: 36px; padding: 10px 4px;
}
#monthlySkeleton .skeleton-date-wrap {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
#monthlySkeleton .skeleton-date-num { width: 22px; height: 14px; display: block; border-radius: 4px; }
#monthlySkeleton .skeleton-date-name { width: 26px; height: 10px; display: block; border-radius: 4px; }
#monthlySkeleton .skeleton-header-task { width: 88px; height: 14px; display: block; border-radius: 4px; }
#monthlySkeleton .skeleton-header-score { width: 24px; height: 12px; margin: 0 auto; display: block; border-radius: 4px; }

#monthlySkeleton .skeleton-heatmap-row { height: 40px; }
#monthlySkeleton .skeleton-heatmap-row td { vertical-align: middle; }
#monthlySkeleton .skeleton-heatmap-row .task-name-col {
  min-width: 200px; max-width: 240px; padding: 0 16px; border-right: 1px solid var(--border);
}
#monthlySkeleton .skeleton-heatmap-row:nth-child(odd) .task-name-col { background: var(--bg); }
#monthlySkeleton .skeleton-task-name { width: 160px; max-width: 100%; height: 14px; display: block; border-radius: 6px; }

#monthlySkeleton .skeleton-heatmap-row .heat-cell {
  padding: 4px; text-align: center; border: 1px solid var(--border);
}
#monthlySkeleton .skeleton-heat-cell { width: 28px; height: 28px; margin: 0 auto; display: block; border-radius: 8px; }
#monthlySkeleton .skeleton-heatmap-row .task-score-col {
  padding: 0 12px; text-align: center; border-left: 1px solid var(--border);
}
#monthlySkeleton .skeleton-score { width: 28px; height: 14px; margin: 0 auto; display: block; border-radius: 4px; }

/* Legend */
#monthlySkeleton .monthly-skeleton-legend {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
#monthlySkeleton .skeleton-legend-label { width: 48px; height: 14px; border-radius: 4px; display: inline-block; }
#monthlySkeleton .skeleton-legend-item { width: 72px; height: 14px; border-radius: 4px; display: inline-block; }

/* ===========================
   MISC
=========================== */
.loading {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 13px;
}

.empty-state {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary-ink);
}
.empty-state .empty-icon svg { width: 26px; height: 26px; }
.empty-state h3 { font-size: 15px; color: var(--text); margin-bottom: 6px; font-weight: 700; }
.empty-state p  { font-size: 13px; }
.empty-state a  { color: var(--primary-ink); text-decoration: none; font-weight: 600; }

/* Setup table empty state */
.pro-section .empty-state {
  padding: 32px 24px;
  background: var(--bg);
  border-radius: 0 0 16px 16px;
}
.pro-section .empty-state .empty-icon { width: 44px; height: 44px; }
.pro-section .empty-state .empty-icon svg { width: 22px; height: 22px; }

/* Table pagination (setup page) */
.pro-table-footer {
  padding: 10px 18px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.pro-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.pro-pagination-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.pro-pagination-middle {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.pro-pagination-info strong {
  color: var(--text);
}
.pro-pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Better wrapping on smaller widths so controls don't overlap */
@media (max-width: 768px) {
  .pro-pagination {
    flex-direction: column;
    align-items: flex-start;
  }
  .pro-pagination-middle {
    justify-content: flex-start;
  }
  .pro-pagination-controls {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}
.pro-page-btn {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s var(--ease-in-out), color 0.15s var(--ease-in-out);
}
.pro-page-btn:hover:not(:disabled) {
  background: var(--primary-light);
  color: var(--primary-ink);
}
.pro-page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.pro-page-label {
  font-size: 12px;
  color: var(--text-muted);
}
.pro-page-size {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pro-page-size-label {
  font-weight: 600;
  color: var(--text-muted);
}
.pro-page-size-select {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f8fafc;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 12px) 55%, calc(100% - 8px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 22px;
}
.pro-page-size-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.year-selector { display: flex; align-items: center; gap: 10px; }
.year-selector label { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.year-selector select {
  padding: 8px 14px;
  font-weight: 700;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.year-selector select:hover {
  border-color: var(--primary-soft);
  background: var(--primary-light);
}
.year-selector select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  outline: none;
}

/* ===========================
   RESPONSIVE
=========================== */
@media (max-width: 1024px) {
  :root { --sidebar-w: 0px; }

  /* Turn sidebar into off‑canvas on mobile & tablet */
  .sidebar {
    width: 230px;
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease-out);
    box-shadow: 8px 0 24px rgba(15,23,42,0.25);
  }

  .sidebar:hover {
    width: 230px;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  body.nav-open .sidebar .logo-text,
  body.nav-open .sidebar .sidebar-nav a span:not(.nav-icon),
  body.nav-open .sidebar .sidebar-user-name,
  body.nav-open .sidebar .btn-sidebar-logout .logout-text {
    opacity: 1;
  }

  .sidebar-logo {
    padding: 20px 18px;
  }

  .sidebar-nav {
    padding: 16px 12px; /* desktop jaisa */
    gap: 6px;
  }

  .sidebar-nav a {
    border-radius: 12px;
    padding: 12px 14px; /* desktop jaisa */
    justify-content: flex-start;
    text-align: left;
  }

  .sidebar-footer {
    padding: 14px 16px;
  }

  .main {
    margin-left: 0;
  }

  .page-header {
    padding: 6px 14px;
    height: auto;
    min-height: 56px;
    flex-wrap: nowrap;
  }

  .page-header h1 {
    font-size: 16px;
    gap: 8px;
    flex: 1;
    align-items: center;
  }

  .page-header h1 span:last-child {
    white-space: nowrap;
  }

  .page-header .page-title-icon svg {
    width: 20px;
    height: 20px;
  }

  .page-header .header-right {
    gap: 6px;
    margin-left: 8px;
  }

  .page-header .header-right .year-selector label {
    font-size: 11px;
  }

  .page-header .header-right .year-selector select {
    padding: 5px 10px;
    font-size: 12px;
  }

  .year-badge {
    padding: 6px 10px;
    font-size: 12px;
  }

  /* Mobile menu button */
  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid var(--border);
    margin-right: 8px;
    background: #fff;
    cursor: pointer;
    padding: 0;
  }

  .mobile-nav-toggle span {
    display: block;
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: var(--text);
    position: relative;
  }

  .mobile-nav-toggle span::before,
  .mobile-nav-toggle span::after {
    content: "";
    position: absolute;
    left: 0;
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: var(--text);
  }

  .mobile-nav-toggle span::before {
    top: -5px;
  }

  .mobile-nav-toggle span::after {
    top: 5px;
  }

  /* Dim background when nav open */
  body.nav-open .main::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 90;
  }

  /* By default (closed), sirf icons dikhayenge */
  .sidebar-logo .logo-text,
  .sidebar-nav a span:not(.nav-icon),
  .sidebar-footer .sidebar-user-name,
  .sidebar-footer .btn-sidebar-logout .logout-text { display: none; }

  /* Jab nav open ho, full labels + user name dikhao */
  body.nav-open .sidebar-logo .logo-text,
  body.nav-open .sidebar-nav a span:not(.nav-icon),
  body.nav-open .sidebar-footer .sidebar-user-name,
  body.nav-open .sidebar-footer .btn-sidebar-logout .logout-text {
    display: inline-block;
  }

  .sidebar-logo { justify-content: center; }
  .sidebar-nav a { justify-content: flex-start; padding: 12px 14px; }
  .sidebar-user { justify-content: center; padding: 10px; }
  .sidebar-footer .btn-sidebar-logout { padding: 10px; }
  .sidebar-footer .btn-sidebar-logout .logout-icon { margin: 0; }
  .charts-row { grid-template-columns: 1fr; }
  .stats-row  { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 14px; }
}

/* Extra tightening for small phones */
@media (max-width: 600px) {
  .pro-toolbar {
    padding: 14px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .pro-toolbar .toolbar-hint {
    width: 100%;
  }

  .pro-section-header {
    padding: 12px 16px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
  }

  .pro-count-pill {
    align-self: auto;
  }

  .pro-table thead th,
  .pro-table tbody td {
    padding: 10px 12px;
    font-size: 12px;
  }

  .pro-task-name {
    font-size: 13px;
  }

  /* Mobile: long text should wrap (no clipping / no one-line overflow) */
  /* Task Name column = 2nd td/th */
  .pro-table thead th:nth-child(2) { min-width: 140px !important; }
  .pro-table tbody td:nth-child(2) {
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .pro-table tbody td:nth-child(2) .pro-task-name {
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.25;
  }

  /* Category column = 3rd td */
  .pro-table tbody td:nth-child(3) {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.2;
  }
  .pro-table tbody td:nth-child(3) span {
    display: inline-block;
    max-width: 120px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.2;
  }

  /* Year Overview (Dashboard): "THIS MONTH" badge should be on 2nd line */
  .dashboard-table .col-month {
    white-space: normal;
  }
  .dashboard-table .col-month .month-name {
    display: block;
  }
  .dashboard-table .col-month .current-month-badge {
    display: inline-block;
    margin-left: 0;
    margin-top: 6px;
  }

  .page-content {
    padding: 12px 10px 18px;
  }

  /* Pagination – tighter and more mobile friendly */
  .pro-table-footer {
    padding: 10px 12px 16px;
  }

  .pro-pagination {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
  }

  .pro-pagination-left {
    width: 100%;
    justify-content: center;
    align-items: center;
    text-align: center;
  }

  .pro-pagination-middle {
    justify-content: center;
    width: 100%;
  }

  .pro-pagination-controls {
    justify-content: center;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .pro-page-btn {
    padding-inline: 10px;
    min-width: 64px;
  }
}

@media (max-width: 480px) {
  /* Allow table to scroll while keeping layout clean */
  .table-wrapper {
    margin: 0 -10px;
    padding: 0 10px 10px;
  }


  .page-header .header-right {
    flex-shrink: 0;
  }
}
