*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-deep: #0e0e14;
  --sidebar-bg: #13131c;
  --sidebar-w: 190px;
  --glass-bg: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.13);
  --glass-shadow: 0 8px 48px rgba(0, 0, 0, 0.45);
  --accent-blue: #7eb6ff;
  --accent-pink: #f7a8d8;
  --accent-teal: #76ead7;
  --accent-purple: #c4a8f7;
  --text-primary: #f0f0f8;
  --text-muted: #7d7d9a;
  --text-dim: #4a4a62;
  --online: #4ade80;
  --danger: #f87171;
  --accent-orange: #ff9500;
}

body.light-mode {
  --bg-deep: #e4e2e2;
  --sidebar-bg: rgba(255, 255, 255, 0.6);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.9);
  --glass-shadow: 0 12px 40px rgba(100, 110, 140, 0.18);
  --accent-blue: #3b82f6;
  --accent-pink: #e11d48;
  --accent-teal: #0d9488;
  --accent-purple: #7c3aed;
  --text-primary: #334155;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --accent-orange: #ea580c;
}

body.light-mode .bg-mesh {
  background:
    radial-gradient(ellipse 60% 55% at 15% 20%, rgba(126, 182, 255, 0.25) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at 80% 80%, rgba(247, 168, 216, 0.22) 0%, transparent 70%),
    radial-gradient(ellipse 55% 45% at 75% 15%, rgba(196, 168, 247, 0.22) 0%, transparent 65%),
    radial-gradient(ellipse 40% 50% at 30% 85%, rgba(118, 234, 215, 0.15) 0%, transparent 65%),
    var(--bg-deep);
}

body.light-mode .orb {
  opacity: 0.5;
}

body.light-mode .task-input,
body.light-mode .priority-select,
body.light-mode .modal-select {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(130, 140, 170, 0.2);
  box-shadow: 0 2px 8px rgba(100, 110, 140, 0.05);
  color: var(--text-primary);
}

body.light-mode .task-input:focus,
body.light-mode .priority-select:focus,
body.light-mode .modal-select:focus {
  background: rgba(255, 255, 255, 1);
  border-color: var(--accent-blue);
  box-shadow: 0 4px 12px rgba(100, 110, 140, 0.1);
}

body.light-mode .task-item {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 15px rgba(100, 110, 140, 0.08);
}

body.light-mode .task-item:hover {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 6px 20px rgba(100, 110, 140, 0.12);
}

body.light-mode .priority-badge.high {
  background: rgba(225, 29, 72, 0.08);
  color: #d94669;
}

body.light-mode .priority-badge.medium {
  background: rgba(234, 88, 12, 0.08);
  color: #d97736;
}

body.light-mode .priority-badge.low {
  background: rgba(59, 130, 246, 0.08);
  color: #5c8deb;
}

body.light-mode .task-check {
  border-color: rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.8);
}

body.light-mode .task-check svg {
  stroke: white;
}

body.light-mode .task-check.checked {
  background: var(--accent-teal);
  border-color: var(--accent-teal);
}

body.light-mode .modal {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 16px 50px rgba(100, 110, 140, 0.25);
  border-color: rgba(255, 255, 255, 1);
}

body.light-mode .folder-tab {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(130, 140, 170, 0.15);
  box-shadow: 0 2px 6px rgba(100, 110, 140, 0.04);
  color: var(--text-muted);
}

body.light-mode .folder-tab:hover {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(130, 140, 170, 0.25);
  color: var(--text-primary);
}

body.light-mode .folder-tab.active {
  background: rgba(255, 255, 255, 1);
  border-color: #a5c6f7;
  box-shadow: 0 4px 12px rgba(100, 110, 140, 0.08);
  color: var(--accent-blue);
}

body.light-mode .folder-tab.drag-over {
  background: rgba(255, 255, 255, 0.9) !important;
  border-color: #a5c6f7 !important;
}

body.light-mode .filter-tabs {
  background: rgba(130, 140, 170, 0.08);
  border: 1px solid rgba(130, 140, 170, 0.1);
}

body.light-mode .filter-tab {
  color: var(--text-muted);
}

body.light-mode .filter-tab:hover {
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-primary);
}

body.light-mode .filter-tab.active {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 6px rgba(100, 110, 140, 0.08);
  color: var(--accent-blue);
}

body.light-mode .sort-select {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(130, 140, 170, 0.15);
  border-radius: 8px;
}

body.light-mode .sort-select:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(130, 140, 170, 0.25);
}

html,
body {
  height: 100%;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  overflow: hidden;
  transition: background 0.4s cubic-bezier(0.4, 0, 0.2, 1), color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Custom Glassmorphic Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ── Animated mesh background ── */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 55% at 15% 20%, rgba(126, 182, 255, 0.12) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at 80% 80%, rgba(247, 168, 216, 0.14) 0%, transparent 70%),
    radial-gradient(ellipse 55% 45% at 75% 15%, rgba(196, 168, 247, 0.10) 0%, transparent 65%),
    radial-gradient(ellipse 40% 50% at 30% 85%, rgba(118, 234, 215, 0.09) 0%, transparent 65%),
    #0e0e14;
  animation: meshShift 12s ease-in-out infinite alternate;
}

@keyframes meshShift {
  0% {
    filter: hue-rotate(0deg) brightness(1);
  }

  100% {
    filter: hue-rotate(18deg) brightness(1.06);
  }
}

/* Floating orbs */
.orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(70px);
  opacity: 0.18;
  animation: orbFloat 18s ease-in-out infinite alternate;
}

.orb-1 {
  width: 420px;
  height: 420px;
  background: #7eb6ff;
  top: -80px;
  left: 10%;
  animation-duration: 14s;
}

.orb-2 {
  width: 350px;
  height: 350px;
  background: #f7a8d8;
  bottom: -60px;
  right: 12%;
  animation-duration: 19s;
}

.orb-3 {
  width: 280px;
  height: 280px;
  background: #c4a8f7;
  top: 40%;
  left: 55%;
  animation-duration: 22s;
  animation-delay: -6s;
}

@keyframes orbFloat {
  0% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(30px, -20px) scale(1.05);
  }

  100% {
    transform: translate(-20px, 25px) scale(0.95);
  }
}

/* ── Grid noise overlay ── */
.noise {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

/* ===== GLASS-CYBER LAYOUT ===== */
.app {
  position: relative;
  z-index: 10;
  max-width: 1160px;
  margin: 0 auto;
  padding: 15px 24px 30px;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 15px;
  flex-shrink: 0;
}

.logo-eyebrow {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  color: var(--accent-blue);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.logo-title {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
}

.logo-sub {
  font-family: 'Space Mono', monospace;
  font-size: 0.6rem;
  color: var(--text-dim);
  letter-spacing: 1px;
  margin-top: 6px;
  text-transform: uppercase;
}

.user-block {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 8px 16px;
}

.current-username {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-primary);
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

body.light-mode .current-username {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(130, 140, 170, 0.15);
}

.op-prefix {
  color: var(--accent-teal);
  font-size: 0.65rem;
  opacity: 0.8;
}

.btn-logout {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-dim);
  font-family: 'Space Mono', monospace;
  font-size: 0.6rem;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  padding: 6px 12px;
  border-radius: 8px;
  letter-spacing: 1px;
}

body.light-mode .btn-logout {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(130, 140, 170, 0.15);
}

/* Theme Toggle Switch */
.theme-switch-wrapper {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  margin: 0 15px;
}

.theme-track {
  width: 46px;
  height: 24px;
  background: #111111;
  /* Even darker for the new design */
  border-radius: 12px;
  position: relative;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  overflow: hidden;
}

body.light-mode .theme-track {
  background: #e0e0e0;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  border-color: rgba(0, 0, 0, 0.1);
}

.theme-icon {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  pointer-events: none;
  transition: opacity 0.3s, color 0.3s;
}

.theme-icon.sun {
  color: #444;
  opacity: 0;
}

.theme-icon.moon {
  color: var(--accent-blue);
  opacity: 1;
}

body.light-mode .theme-icon.sun {
  opacity: 1;
}

body.light-mode .theme-icon.moon {
  opacity: 0;
}

.theme-thumb {
  width: 18px;
  height: 18px;
  background: #ffffff;
  /* White in dark mode */
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.4s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  z-index: 2;
}

body.light-mode .theme-thumb {
  background: #333333;
  /* Dark in light mode */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.theme-track.on .theme-thumb {
  transform: translateX(22px);
}

/* Small login-page toggle override */
#theme-track-sm.on #theme-thumb-sm {
  transform: translateX(22px);
}

.btn-logout:hover {
  background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.3);
  color: var(--danger);
}

body.light-mode .btn-logout:hover {
  background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.3);
}

.stats-row {
  display: flex;
  gap: 12px;
}

.stat-box {
  padding: 8px 14px;
  text-align: center;
  min-width: 60px;
  border-radius: 12px !important;
}

.stat-num {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
}

.stat-label {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 4px;
}

.layout-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 30px;
  align-items: start;
  flex: 1;
  min-height: 0;
}

.sidebar {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.sidebar-title {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  color: var(--accent-blue);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.main-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.folder-bar {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Folder items glass styling */
.folder-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
}

.folder-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.folder-tab.active {
  background: rgba(126, 182, 255, 0.1);
  border-color: rgba(126, 182, 255, 0.2);
  color: var(--accent-blue);
}

.folder-icon {
  width: 14px;
  height: 14px;
  opacity: 0.5;
  flex-shrink: 0;
}

.folder-tab.active .folder-icon,
.folder-tab:hover .folder-icon {
  opacity: 1;
}

.folder-tab.drag-over {
  background: rgba(126, 182, 255, 0.2) !important;
  border-color: rgba(126, 182, 255, 0.4) !important;
  box-shadow: inset 0 0 10px rgba(126, 182, 255, 0.1);
}

.folder-tab-name {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.folder-tab-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: 0.2s;
}

.folder-tab:hover .folder-actions {
  opacity: 1;
}

@media (max-width: 768px) {
  .folder-actions {
    opacity: 1;
  }
}

.folder-action-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
}

.folder-action-btn:hover {
  color: var(--accent-blue);
}

.folder-action-btn.del:hover {
  color: var(--danger);
}

.shared-badge {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 6px;
  background: rgba(196, 168, 247, 0.15);
  color: var(--accent-purple);
}

.btn-new-folder {
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: var(--text-dim);
  padding: 8px;
  margin-top: 8px;
  cursor: pointer;
  text-align: left;
  transition: 0.2s;
  font-size: 12px;
}

.btn-new-folder:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.input-zone {
  margin-bottom: 15px;
}

.input-zone-label {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  color: var(--accent-teal);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.input-row {
  display: flex;
  gap: 10px;
}

.task-input,
.priority-select {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: 8px;
  outline: none;
  transition: 0.2s;
  font-family: inherit;
}

.task-input {
  flex: 1;
}

.task-input:focus,
.priority-select:focus,
.date-input:focus {
  border-color: var(--accent-teal);
  background: rgba(118, 234, 215, 0.05);
}

.priority-select {
  font-size: 12px;
  cursor: pointer;
  appearance: none;
  padding-right: 24px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237d7d9a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.priority-select option {
  background: var(--bg-deep);
}

.date-input {
  width: 170px;
  font-size: 12px;
  font-family: 'Space Mono', monospace;
  cursor: pointer;
}

/* Custom Date Picker Icons */
::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(0.5);
  cursor: pointer;
}

::-webkit-calendar-picker-indicator:hover {
  filter: invert(1) opacity(0.8);
}

.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.filter-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.filter-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: 0.2s;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.filter-tab:hover {
  color: var(--text-primary);
}

.filter-tab.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.sort-select {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  outline: none;
  appearance: none;
  padding-right: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%234a4a62' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
}

.sort-select:hover {
  color: var(--text-primary);
}

.sort-select option {
  background: var(--bg-deep);
}

.task-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 4px;
}

/* Custom Task Item Glass styling matching requested image */
.task-item {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  margin-bottom: 0px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-top 0s;
  backdrop-filter: blur(10px);
  position: relative;
  /* Removed overflow: hidden so overdue date tag does not get cut off */
}

.task-item[draggable="true"] {
  cursor: grab;
}

.task-item[draggable="true"]:active {
  cursor: grabbing;
}

.task-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.task-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent-blue);
  border-radius: 4px 0 0 4px;
}

.task-item.priority-high::before {
  background: var(--accent-pink);
}

.task-item.priority-medium::before {
  background: var(--accent-orange);
}

.task-item.done::before {
  background: var(--text-dim);
}

.task-item.done {
  opacity: 0.6;
}

.task-check {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.2s;
  flex-shrink: 0;
  margin-right: 16px;
}

.task-check svg {
  opacity: 0;
  transition: 0.2s;
  stroke: var(--bg-deep);
}

.task-check:hover {
  border-color: var(--accent-teal);
}

.task-check.checked {
  background: var(--accent-teal);
  border-color: var(--accent-teal);
}

.task-check.checked svg {
  opacity: 1;
}

.task-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.task-text {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.4;
  word-break: break-word;
}

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

.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-family: 'Space Mono', monospace;
  flex-wrap: wrap;
  width: 100%;
}

.priority-badge {
  padding: 4px 6px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 1px;
  display: inline-flex;
  align-items: center;
  height: 18px;
}

.priority-badge.high {
  background: rgba(247, 168, 216, 0.15);
  color: var(--accent-pink);
}

.priority-badge.medium {
  background: rgba(255, 149, 0, 0.15);
  color: var(--accent-orange);
}

.priority-badge.low {
  background: rgba(126, 182, 255, 0.15);
  color: var(--accent-blue);
}

.task-date {
  color: var(--text-dim);
}

.task-date-spacer {
  flex: 1;
}

.task-date.due {
  color: var(--accent-teal);
  white-space: nowrap;
}

.task-date.due.overdue {
  color: var(--danger);
  font-weight: bold;
  background: rgba(248, 113, 113, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.task-actions {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: 0.2s;
}

.task-item:hover .task-actions {
  opacity: 1;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.icon-btn.delete:hover {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
}

/* Progress bar */
.progress-section {
  position: relative;
  z-index: 1;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-family: 'Space Mono', monospace;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.progress-track {
  background: rgba(255, 255, 255, 0.05);
  height: 4px;
  border-radius: 2px;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: var(--accent-teal);
  border-radius: 2px;
  transition: width 0.3s;
  box-shadow: 0 0 10px var(--accent-teal);
}

#progress-pct {
  color: var(--accent-teal);
}

body.light-mode .progress-track {
  background: rgba(130, 140, 170, 0.2);
  box-shadow: inset 0 1px 3px rgba(100, 110, 140, 0.1);
}

body.light-mode .progress-fill {
  background: linear-gradient(90deg, #c084fc, #a855f7) !important;
  background-image: linear-gradient(90deg, #c084fc, #a855f7) !important;
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.45) !important;
}

body.light-mode #progress-pct {
  color: #9333ea !important;
}


/* ── Reused Glass Card (for Login, Tasks) ── */
.glass-card {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.02) inset,
    var(--glass-shadow),
    0 0 80px rgba(126, 182, 255, 0.03);
  position: relative;
  overflow: hidden;
}

.glass-card.login-card {
  max-width: 420px;
  margin: auto;
  padding: 36px 36px 32px;
  margin-top: 10vh;
  animation: cardIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Corner accent glow */
.glass-card::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 24px;
  right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(126, 182, 255, 0.6), rgba(247, 168, 216, 0.5), transparent);
  border-radius: 1px;
}

/* Inner glow */
.glass-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: radial-gradient(ellipse 70% 100% at 50% 0%, rgba(126, 182, 255, 0.06), transparent);
  pointer-events: none;
  border-radius: 20px 20px 0 0;
}

.card-header {
  margin-bottom: 28px;
  position: relative;
  z-index: 1;
}

.card-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.eyebrow-badge {
  background: rgba(126, 182, 255, 0.15);
  border: 1px solid rgba(126, 182, 255, 0.25);
  color: var(--accent-blue);
  font-family: 'Space Mono', monospace;
  font-size: 8px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.eyebrow-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(126, 182, 255, 0.25), transparent);
}

.card-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 26px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.card-title span {
  color: var(--accent-blue);
}

.card-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 300;
}

.card-subtitle code {
  font-family: 'Space Mono', monospace;
  font-size: 10.5px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 5px;
  border-radius: 3px;
}

/* ── Login Form & Inputs ── */
.form {
  position: relative;
  z-index: 1;
}

.field {
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
  font-family: 'Space Mono', monospace;
}

.field-wrap {
  position: relative;
}

.field-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 14px;
  pointer-events: none;
  transition: color 0.2s;
}

input[type="text"],
input[type="password"],
input[type="email"] {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 11px 13px 11px 38px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s ease;
  caret-color: var(--accent-blue);
}

body.light-mode input[type="text"],
body.light-mode input[type="password"],
body.light-mode input[type="email"] {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(130, 140, 170, 0.2);
  box-shadow: 0 2px 8px rgba(100, 110, 140, 0.05);
}

input.no-icon {
  padding-left: 13px;
}

input::placeholder {
  color: var(--text-dim);
  font-size: 13px;
}

input:focus {
  border-color: rgba(126, 182, 255, 0.45);
  background: rgba(126, 182, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(126, 182, 255, 0.1), 0 2px 12px rgba(0, 0, 0, 0.3);
}

body.light-mode input:focus {
  background: rgba(255, 255, 255, 1);
  border-color: var(--accent-blue);
  box-shadow: 0 4px 12px rgba(100, 110, 140, 0.1);
}

input:focus+.field-icon,
.field-wrap:focus-within .field-icon {
  color: var(--accent-blue);
}

select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 9px 12px;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

select option {
  background: var(--sidebar-bg);
}

/* eye toggle */
.eye-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 2px;
  transition: color 0.18s;
}

.eye-btn:hover {
  color: var(--text-muted);
}

.field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.forgot-link {
  font-size: 11px;
  color: var(--accent-blue);
  opacity: 0.75;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.18s;
}

.forgot-link:hover {
  opacity: 1;
}

/* 2FA toggle */
.two-fa-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  margin-bottom: 20px;
  cursor: pointer;
  transition: background 0.18s;
}

body.light-mode .two-fa-row {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(130, 140, 170, 0.15);
  box-shadow: 0 2px 6px rgba(100, 110, 140, 0.04);
}

.two-fa-row:hover {
  background: rgba(255, 255, 255, 0.06);
}

body.light-mode .two-fa-row:hover {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(130, 140, 170, 0.25);
}

.toggle-track {
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.12);
  position: relative;
  flex-shrink: 0;
  transition: background 0.25s;
}

body.light-mode .toggle-track {
  background: rgba(130, 140, 170, 0.2);
}

.toggle-track.on {
  background: rgba(126, 182, 255, 0.55);
}

body.light-mode .toggle-track.on {
  background: var(--accent-blue);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

body.light-mode .toggle-thumb {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-track.on .toggle-thumb {
  transform: translateX(14px);
}

.two-fa-text {
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
}

.two-fa-text strong {
  color: var(--text-primary);
  font-weight: 500;
  display: block;
  font-size: 12.5px;
}

.two-fa-badge {
  font-size: 9px;
  font-family: 'Space Mono', monospace;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(118, 234, 215, 0.12);
  color: var(--accent-teal);
  border: 1px solid rgba(118, 234, 215, 0.2);
  font-weight: 700;
  letter-spacing: 0.06em;
}

/* Submit & Add buttons */
.btn-primary {
  padding: 11px 18px;
  background: linear-gradient(135deg, rgba(118, 234, 215, 0.25) 0%, rgba(126, 182, 255, 0.2) 100%);
  border: 1px solid rgba(118, 234, 215, 0.35);
  border-radius: 8px;
  color: var(--accent-teal);
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.05em;
  position: relative;
  overflow: hidden;
  transition: all 0.22s ease;
  box-shadow: 0 4px 20px rgba(118, 234, 215, 0.12);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(118, 234, 215, 0.38) 0%, rgba(126, 182, 255, 0.3) 100%);
  border-color: rgba(118, 234, 215, 0.55);
  box-shadow: 0 6px 30px rgba(118, 234, 215, 0.22);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.1) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}

.btn-primary:hover::before {
  transform: translateX(100%);
}

.btn-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.btn-arrow {
  font-size: 16px;
  transition: transform 0.2s;
}

.btn-primary:hover .btn-arrow {
  transform: translateX(3px);
}

/* Smaller secondary button */
.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.show {
  display: flex;
}

.modal {
  background: rgba(19, 19, 28, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-title {
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* Error toast */
.err-msg {
  display: none;
  color: var(--danger);
  font-size: 12px;
  margin-bottom: 12px;
  text-align: center;
}

.err-msg.on {
  display: block;
  animation: shake 0.4s;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-4px);
  }

  75% {
    transform: translateX(4px);
  }
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #13131c;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 3px solid var(--accent-blue);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 12px;
  z-index: 2000;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Space Mono', monospace;
}

body.light-mode .toast {
  background: #ffffff;
  border: 1px solid rgba(130, 140, 170, 0.2);
  border-left: 3px solid var(--accent-blue);
  color: var(--text-primary);
  box-shadow: 0 4px 15px rgba(100, 110, 140, 0.15);
}

.toast.show {
  transform: translateX(0);
}

/* ===== MOBILE RESPONSIVENESS ===== */
@media (max-width: 768px) {
  .app {
    padding: 20px 14px 40px;
    height: auto;
    min-height: 100vh;
  }

  html,
  body {
    height: auto;
    overflow: auto;
  }

  .layout-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .logo-block {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .user-block {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .stats-row {
    width: 100%;
    justify-content: space-between;
  }

  .stat-box {
    flex: 1;
    min-width: 0;
    padding: 10px;
  }

  .sidebar {
    height: auto;
    padding: 12px;
  }

  .folder-bar {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .folder-bar::-webkit-scrollbar {
    height: 6px;
  }

  .folder-tab {
    white-space: nowrap;
    width: auto;
    flex-shrink: 0;
  }

  .main-content {
    padding: 15px !important;
    height: auto;
  }

  .input-row {
    flex-direction: column;
  }

  .date-input {
    width: 100%;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .filter-tabs {
    justify-content: space-between;
  }

  .filter-tab {
    flex: 1;
    text-align: center;
  }

  .sort-select {
    width: 100%;
  }

  .task-item {
    flex-direction: row;
    align-items: flex-start;
    padding: 12px;
  }

  .task-body {
    min-width: 0;
    width: 100%;
    padding-right: 8px;
    /* space before actions */
  }

  .task-check {
    margin-bottom: 0px;
    margin-right: 12px;
    margin-top: 2px;
  }

  .task-text {
    font-size: 13.5px;
  }

  .task-meta {
    gap: 6px;
    font-size: 10px;
  }

  .task-date.due {
    display: block;
    margin-top: 4px;
  }

  .task-actions {
    opacity: 1;
    width: auto;
    margin-left: auto;
    align-self: center;
    flex-direction: column;
    margin-top: 0;
    border-top: none;
    padding-top: 0;
  }

  body.light-mode .task-actions {
    border-top: none;
  }

  /* Modal fixes */
  .modal {
    padding: 16px;
    max-width: calc(100% - 32px);
    margin: auto;
    width: 100%;
  }

  #edit-modal .field {
    display: flex;
    flex-direction: column;
  }
}