/* --------------------------------------------------------------------------
   3. APP SHELL & SIDEBAR
   -------------------------------------------------------------------------- */
.app-layout {
  position: relative;
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  backdrop-filter: blur(24px) saturate(130%);
  -webkit-backdrop-filter: blur(24px) saturate(130%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  transition: transform 300ms var(--ease-smooth), background-color 300ms ease;
}

.sidebar-header {
  padding: 1.5rem 1.4rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  user-select: none;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.025em;
}

.brand-dot {
  color: var(--accent);
  font-size: 1.1rem;
  line-height: 1;
  text-shadow: 0 0 12px var(--accent-glow);
}

.sidebar-scrollable {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.5rem 0.3rem;
}

.nav-group-title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  padding: 0 0.5rem;
}

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.65rem 0.85rem;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.93rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 160ms var(--ease-smooth);
  text-align: left;
}

.nav-item:hover {
  background: var(--panel-subtle);
  color: var(--text);
  transform: translateX(2px);
}

.nav-item.active {
  background: var(--panel-strong);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.nav-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--muted);
  transition: color 160ms ease;
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
  color: var(--accent);
}

.nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-count {
  font-size: 0.78rem;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
  background: var(--panel-subtle);
  color: var(--muted);
  font-weight: 600;
}

.nav-item.active .nav-count {
  background: var(--accent-soft);
  color: var(--accent);
}

.project-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}

.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.2rem 0.5rem;
}

.sidebar-tag-pill {
  border: 1px solid var(--border);
  background: var(--panel-subtle);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 160ms var(--ease-smooth);
}

.sidebar-tag-pill:hover,
.sidebar-tag-pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* Sidebar Footer & User Profile */
.sidebar-footer {
  padding: 1.1rem 1.3rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.user-profile-wrap {
  position: relative;
}

.user-profile-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.6rem;
  border-radius: 12px;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 150ms ease;
}

.user-profile-btn:hover {
  background: var(--panel-subtle);
}

.user-avatar {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: white;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 4px 12px var(--accent-glow);
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 120px;
}

.user-status {
  font-size: 0.74rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 120px;
}

.profile-chevron {
  margin-left: auto;
  color: var(--muted);
  transition: transform 200ms var(--ease-smooth);
}

.user-profile-wrap.open .profile-chevron {
  transform: rotate(180deg);
}

/* Floating Account Menu */
.user-account-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.65rem;
  box-shadow: var(--shadow);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: all 200ms var(--ease-smooth);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.user-profile-wrap.open .user-account-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.account-menu-header {
  padding: 0.4rem 0.6rem;
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
}

.account-menu-header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-header span {
  font-size: 0.75rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-divider {
  height: 1px;
  background: var(--border-light);
  margin: 0.4rem 0;
}

.account-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.84rem;
  cursor: pointer;
  text-align: left;
  transition: all 140ms ease;
}

.account-menu-item:hover {
  background: var(--panel-subtle);
  color: var(--text);
}

.account-menu-badge {
  font-size: 0.68rem;
  color: var(--muted);
  padding: 0.3rem 0.6rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}

.sidebar-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--panel-subtle);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 180ms var(--ease-smooth);
}

.theme-toggle-btn:hover {
  background: var(--panel-strong);
  color: var(--text);
  border-color: var(--border-focus);
}

[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: block; }
[data-theme="light"] .theme-icon-dark { display: none; }
[data-theme="light"] .theme-icon-light { display: block; }

.shortcut-hint {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--muted);
}

.shortcut-hint kbd {
  background: var(--panel-subtle);
  border: 1px solid var(--border);
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-family: inherit;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   4. MAIN WORKSPACE & RESPONSIVE GRID
   -------------------------------------------------------------------------- */
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.main-scrollable {
  width: min(100% - 2.5rem, 1420px);
  margin: 0 auto;
  padding: 2.2rem 1.5rem 5rem;
}

/* Large Desktop Two-Column Layout (>= 1350px) */
.workspace-grid {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 1.75rem;
  align-items: start;
}

.workspace-primary {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.workspace-secondary {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  position: sticky;
  top: 1.8rem;
}

/* --------------------------------------------------------------------------
   5. HERO & TODAY GREETING
   -------------------------------------------------------------------------- */
.hero-section {
  margin-bottom: 1.5rem;
}

.hero-date-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 0.35rem;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 3.8vw, 3.4rem);
  line-height: 1.06;
  letter-spacing: -0.025em;
  margin: 0 0 0.45rem;
  color: var(--text);
}

.hero-name-highlight {
  color: var(--accent-hover);
  background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-copy {
  margin: 0 0 1.25rem;
  font-size: 1.06rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* --------------------------------------------------------------------------
   6. CLICKABLE STAT CARDS
   -------------------------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.95rem;
}

.stat-card,
.panel {
  backdrop-filter: blur(20px) saturate(130%);
  -webkit-backdrop-filter: blur(20px) saturate(130%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.stat-card {
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
  transition: transform 200ms var(--ease-smooth), box-shadow 200ms var(--ease-smooth), border-color 200ms ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  opacity: 0.7;
}

.stat-card-today::before { background: var(--accent); }
.stat-card-overdue::before { background: var(--danger); }
.stat-card-completed::before { background: var(--success); }
.stat-card-streak::before { background: var(--warning); }

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: rgba(255, 255, 255, 0.16);
}

.stat-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.stat-card:active {
  transform: translateY(0);
}

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

.stat-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
}

.stat-card-icon {
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: transform 160ms ease;
}

.stat-card:hover .stat-card-icon {
  transform: scale(1.1);
}

.stat-card-today .stat-card-icon { color: var(--accent); }
.stat-card-overdue .stat-card-icon { color: var(--danger); }
.stat-card-completed .stat-card-icon { color: var(--success); }
.stat-card-streak .stat-card-icon { color: var(--warning); }

.stat-value-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.stat-number {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 2.8vw, 2.5rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stat-subtext {
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 500;
}

.panel {
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.15rem;
}
