/* ============================================================
   styles.css — Taskfire Design System
   Palette: Volcanic Glass (#1A1A1A, #333, #FF6B2B, #FFB088)
   Fonts: Outfit (display/UI) + Newsreader (accents)
   ============================================================ */

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
  /* Colors */
  --bg-base:        #111111;
  --bg-surface:     #1A1A1A;
  --bg-elevated:    #222222;
  --bg-hover:       #2A2A2A;
  --bg-border:      #333333;
  --bg-border-soft: #2A2A2A;

  --text-primary:   #F0EDE8;
  --text-secondary: #A09A92;
  --text-muted:     #666660;
  --text-inverse:   #111111;

  --accent:         #FF6B2B;
  --accent-hover:   #FF8247;
  --accent-soft:    rgba(255, 107, 43, 0.12);
  --accent-glow:    rgba(255, 107, 43, 0.25);
  --accent-light:   #FFB088;

  --success:        #4ADE80;
  --success-soft:   rgba(74, 222, 128, 0.12);
  --warning:        #FBBF24;
  --warning-soft:   rgba(251, 191, 36, 0.12);
  --danger:         #F87171;
  --danger-soft:    rgba(248, 113, 113, 0.12);
  --danger-hover:   #EF4444;

  --priority-low:    #4ADE80;
  --priority-medium: #FBBF24;
  --priority-high:   #FF6B2B;

  /* Typography */
  --font-ui:      'Outfit', sans-serif;
  --font-serif:   'Newsreader', Georgia, serif;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Radii */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.6);
  --shadow-accent: 0 4px 24px rgba(255,107,43,0.3);

  /* Transitions */
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 400ms;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-ui);
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Screen-reader only utility */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Background Grid ────────────────────────────────────────── */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255,107,43,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,107,43,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

/* ── Orbs (auth page only) ──────────────────────────────────── */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  animation: orb-drift 12s ease-in-out infinite alternate;
}
.orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(255,107,43,0.15), transparent 70%);
  top: -150px; right: -100px;
  animation-delay: 0s;
}
.orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(255,176,136,0.08), transparent 70%);
  bottom: -100px; left: -80px;
  animation-delay: -6s;
}
@keyframes orb-drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, 20px) scale(1.05); }
}

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3 { font-family: var(--font-ui); font-weight: 600; line-height: 1.2; }
h1 { font-size: clamp(1.5rem, 3vw, 2rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }

p { color: var(--text-secondary); }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition:
    background var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    opacity var(--duration-fast);
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: var(--shadow-accent);
  transform: translateY(-1px);
}
.btn-primary.btn-success {
  background: var(--success);
  color: var(--text-inverse);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--bg-border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--bg-border-soft);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(248,113,113,0.2);
}
.btn-danger:hover:not(:disabled) {
  background: var(--danger);
  color: #fff;
}

.btn-full { width: 100%; }

.btn-add-task {
  padding: 10px 18px;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.btn.loading {
  position: relative;
  color: transparent;
}
.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Form Elements ──────────────────────────────────────────── */
.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}
.form-field:last-of-type { margin-bottom: 0; }

.form-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.required-star { color: var(--accent); }
.optional-label { color: var(--text-muted); font-weight: 400; text-transform: none; letter-spacing: 0; }

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
  z-index: 1;
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  transition:
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    background var(--duration-fast);
  outline: none;
  -webkit-appearance: none;
}

/* When input has icon, add left padding */
.input-wrapper .form-input { padding-left: 40px; }
/* When input has toggle button */
.input-wrapper .toggle-password ~ .form-input,
.input-wrapper .form-input:has(~ .toggle-password) { padding-right: 44px; }
.input-wrapper .form-input { padding-right: 44px; }
/* Override for inputs without toggle */
.input-wrapper:not(:has(.toggle-password)) .form-input { padding-right: 14px; }

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--bg-surface);
}
.form-input::placeholder { color: var(--text-muted); }

.form-textarea {
  resize: vertical;
  min-height: 80px;
  padding-left: 14px !important;
  line-height: 1.5;
}

.form-select {
  padding-left: 14px !important;
  cursor: pointer;
  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='%23666660' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px !important;
}
.form-select option { background: var(--bg-elevated); }

/* Field validation states */
.field-error .form-input { border-color: var(--danger); }
.field-error .form-input:focus { box-shadow: 0 0 0 3px var(--danger-soft); }
.field-success .form-input { border-color: var(--success); }
.field-success .form-input:focus { box-shadow: 0 0 0 3px var(--success-soft); }

.field-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  min-height: 1em;
  transition: color var(--duration-fast);
}
.field-error .field-hint { color: var(--danger); }
.field-success .field-hint { color: var(--success); }

/* Password toggle */
.toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  transition: color var(--duration-fast);
  z-index: 2;
}
.toggle-password:hover { color: var(--text-primary); }

/* Form row (side by side) */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ── Messages ───────────────────────────────────────────────── */
.form-message {
  display: none;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-bottom: var(--space-4);
  line-height: 1.4;
}
.form-message.visible { display: block; }
.error-msg {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(248,113,113,0.2);
}
.success-msg {
  background: var(--success-soft) !important;
  color: var(--success) !important;
  border: 1px solid rgba(74,222,128,0.2) !important;
}

/* ── Shake animation ────────────────────────────────────────── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}
.shake { animation: shake 0.45s var(--ease-out); }

/* ══════════════════════════════════════════════════════════════
   AUTH PAGE
   ══════════════════════════════════════════════════════════════ */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-6);
}

.auth-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  animation: fade-up 0.5s var(--ease-out) both;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Brand */
.auth-brand {
  text-align: center;
}
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  margin-bottom: var(--space-2);
}
.brand-name {
  font-family: var(--font-ui);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.brand-tagline {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Auth Card */
.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

/* Tab Nav */
.tab-nav {
  display: flex;
  position: relative;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--bg-border);
}
.tab-btn {
  flex: 1;
  padding: var(--space-4) var(--space-5);
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--duration-fast);
  position: relative;
  z-index: 1;
}
.tab-btn.active { color: var(--text-primary); }
.tab-btn:hover:not(.active) { color: var(--text-secondary); }

.tab-indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 50%;
  height: 2px;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: transform var(--duration-base) var(--ease-out);
}
/* Move indicator when signup tab is active */
#signup-panel.active ~ .tab-indicator,
.tab-nav:has([data-tab="signup"].active) .tab-indicator {
  transform: translateX(100%);
}

/* Tab Panels */
.tab-panel {
  display: none;
  padding: var(--space-8);
  animation: fade-in 0.25s var(--ease-out) both;
}
.tab-panel.active { display: block; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panel-header { margin-bottom: var(--space-6); }
.panel-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}
.panel-subtitle { font-size: 0.875rem; color: var(--text-muted); }

.auth-switch {
  text-align: center;
  margin-top: var(--space-5);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: inherit;
  font-weight: 500;
  padding: 0;
  transition: color var(--duration-fast);
}
.link-btn:hover { color: var(--accent-hover); }

/* Auth Footer */
.auth-footer {
  text-align: center;
}
.auth-footer p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ══════════════════════════════════════════════════════════════
   APP PAGE
   ══════════════════════════════════════════════════════════════ */

/* ── App Header ─────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(17,17,17,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--bg-border);
}
.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 var(--space-6);
  height: 64px;
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

/* Header stats */
.header-stats {
  display: flex;
  gap: var(--space-3);
  flex: 1;
  justify-content: center;
}
.stat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-full);
  min-width: 56px;
}
.stat-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}
.stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat-chip--done   { border-color: rgba(74,222,128,0.2); }
.stat-chip--done .stat-value { color: var(--success); }
.stat-chip--pending { border-color: rgba(251,191,36,0.2); }
.stat-chip--pending .stat-value { color: var(--warning); }
.stat-chip--high   { border-color: rgba(255,107,43,0.2); }
.stat-chip--high .stat-value { color: var(--accent); }

/* User menu */
.user-menu { position: relative; }
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: box-shadow var(--duration-fast);
  user-select: none;
}
.user-avatar:hover { box-shadow: 0 0 0 3px var(--accent-soft); }

.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  min-width: 200px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  pointer-events: none;
  transition:
    opacity var(--duration-base) var(--ease-out),
    transform var(--duration-base) var(--ease-out);
  z-index: 200;
}
.user-dropdown.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.dropdown-header {
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dropdown-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}
.dropdown-username {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.dropdown-divider {
  border: none;
  border-top: 1px solid var(--bg-border);
  margin: 0;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-5);
  background: none;
  border: none;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--duration-fast), color var(--duration-fast);
  text-align: left;
}
.dropdown-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.dropdown-item--danger:hover { color: var(--danger); }

/* ── App Main ───────────────────────────────────────────────── */
.app-main {
  position: relative;
  z-index: 1;
  padding: var(--space-8) var(--space-6) var(--space-16);
}
.app-container {
  max-width: 900px;
  margin: 0 auto;
}

/* Page title row */
.page-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
  animation: fade-up 0.4s var(--ease-out) both;
}
.page-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}
.page-subtitle {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Toolbar ────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
  animation: fade-up 0.4s var(--ease-out) 0.05s both;
}

.search-wrapper {
  position: relative;
  flex: 1;
  min-width: 180px;
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-input::placeholder { color: var(--text-muted); }
/* Remove default search clear button */
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; }

.filter-pills {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.filter-pill {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background var(--duration-fast),
    color var(--duration-fast),
    border-color var(--duration-fast);
  white-space: nowrap;
}
.filter-pill:hover { background: var(--bg-hover); color: var(--text-primary); }
.filter-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.sort-select {
  padding: 8px 32px 8px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  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='%23666660' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color var(--duration-fast);
}
.sort-select:focus { border-color: var(--accent); outline: none; }
.sort-select option { background: var(--bg-elevated); }

/* ── Progress Bar ───────────────────────────────────────────── */
.progress-section {
  margin-bottom: var(--space-6);
  animation: fade-up 0.4s var(--ease-out) 0.1s both;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
#progress-pct { color: var(--accent); font-weight: 600; }
.progress-track {
  height: 4px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 0.6s var(--ease-out);
}

/* ── Task List ──────────────────────────────────────────────── */
.task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ── Task Card ──────────────────────────────────────────────── */
.task-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-4);
  align-items: start;
  transition:
    border-color var(--duration-fast),
    box-shadow var(--duration-fast),
    transform var(--duration-fast),
    opacity var(--duration-base);
  animation: card-in 0.3s var(--ease-out) both;
  position: relative;
  overflow: hidden;
}
.task-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: var(--priority-medium);
  transition: background var(--duration-fast);
}
.task-card[data-priority="low"]::before    { background: var(--priority-low); }
.task-card[data-priority="medium"]::before { background: var(--priority-medium); }
.task-card[data-priority="high"]::before   { background: var(--priority-high); }

.task-card:hover {
  border-color: var(--bg-border-soft);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.task-card.completed {
  opacity: 0.55;
}
.task-card.completed:hover { opacity: 0.75; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes card-out {
  from { opacity: 1; transform: scale(1); max-height: 200px; }
  to   { opacity: 0; transform: scale(0.97); max-height: 0; padding: 0; margin: 0; }
}
.task-card.removing {
  animation: card-out 0.25s var(--ease-out) forwards;
  overflow: hidden;
}

/* Checkbox */
.task-checkbox-wrapper {
  padding-top: 2px;
}
.task-checkbox {
  width: 20px; height: 20px;
  border-radius: 6px;
  border: 2px solid var(--bg-border);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    background var(--duration-fast),
    border-color var(--duration-fast),
    transform var(--duration-fast) var(--ease-spring);
  appearance: none;
  -webkit-appearance: none;
  position: relative;
}
.task-checkbox:checked {
  background: var(--success);
  border-color: var(--success);
  transform: scale(1.1);
}
.task-checkbox:checked::after {
  content: '';
  position: absolute;
  width: 5px; height: 9px;
  border: 2px solid #111;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translate(-1px, -1px);
}
.task-checkbox:hover:not(:checked) {
  border-color: var(--success);
  background: var(--success-soft);
}

/* Task body */
.task-body { min-width: 0; }
.task-title-text {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  word-break: break-word;
  transition: color var(--duration-fast);
}
.task-card.completed .task-title-text {
  text-decoration: line-through;
  color: var(--text-muted);
}
.task-description {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
  word-break: break-word;
}
.task-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
  flex-wrap: wrap;
}
.task-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.badge-priority-low    { background: rgba(74,222,128,0.1);  color: var(--priority-low); }
.badge-priority-medium { background: rgba(251,191,36,0.1);  color: var(--priority-medium); }
.badge-priority-high   { background: rgba(255,107,43,0.12); color: var(--priority-high); }

.task-due {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.task-due.overdue { color: var(--danger); }
.task-due.due-soon { color: var(--warning); }

.task-date-created {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: auto;
}

/* Task actions */
.task-actions {
  display: flex;
  gap: var(--space-1);
  opacity: 0;
  transition: opacity var(--duration-fast);
}
.task-card:hover .task-actions,
.task-card:focus-within .task-actions {
  opacity: 1;
}
.task-action-btn {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.task-action-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.task-action-btn.delete:hover { color: var(--danger); background: var(--danger-soft); }

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-6);
  animation: fade-in 0.4s var(--ease-out) both;
}
.empty-icon {
  color: var(--text-muted);
  margin-bottom: var(--space-5);
  opacity: 0.4;
}
.empty-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}
.empty-body {
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.6;
}
.empty-body strong { color: var(--text-secondary); }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  animation: overlay-in 0.2s var(--ease-out) both;
}
.modal-overlay[hidden] { display: none; }

@keyframes overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.3s var(--ease-spring) both;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-card--sm { max-width: 380px; }

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6) var(--space-6) 0;
  margin-bottom: var(--space-5);
}
.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

#task-form {
  padding: 0 var(--space-6) var(--space-6);
}

.modal-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--bg-border);
}

.delete-body {
  padding: 0 var(--space-6) var(--space-5);
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.modal-card--sm .modal-actions {
  padding: 0 var(--space-6) var(--space-6);
  border-top: none;
  margin-top: 0;
}

/* ── Toast ──────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transition: transform 0.35s var(--ease-spring), opacity 0.35s;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .header-stats { display: none; }
  .header-inner { padding: 0 var(--space-4); gap: var(--space-4); }
  .app-main { padding: var(--space-6) var(--space-4) var(--space-12); }
  .page-title-row { flex-direction: column; gap: var(--space-3); }
  .btn-add-task { width: 100%; }
  .toolbar { gap: var(--space-2); }
  .filter-pills { order: 3; width: 100%; }
  .sort-select { font-size: 0.75rem; }
  .tab-panel { padding: var(--space-6); }
  .modal-card { border-radius: var(--radius-lg); }
  .task-actions { opacity: 1; }
}

@media (max-width: 400px) {
  .auth-page { padding: var(--space-4); }
  .tab-panel { padding: var(--space-5); }
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Focus visible ──────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}