/* ═══════════════════════════════════════════════════
   TOKENS & RESET  — same as Notes app
════════════════════════════════════════════════════ */
:root {
  /* Brand */
  --accent: #EC5B13;
  --accent-hover: #D55211;
  --accent-soft: #FEF0E7;

  /* Surfaces */
  --bg: #F5F4F0;
  --surface: #FFFFFF;
  --surface-alt: #F9F8F6;
  --sidebar-bg: #1A1A1A;
  --sidebar-text: #E8E5DF;
  --sidebar-muted: #9A9590;
  --sidebar-hover: #2A2A2A;
  --sidebar-active: #2E2E2B;

  /* Text */
  --text-primary: #111210;
  --text-secondary: #6B6860;
  --text-muted: #A8A49E;

  /* Borders */
  --border: #E4E2DC;

  /* Layout */
  --sidebar-w: 280px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .10);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, .18), 0 8px 16px rgba(0, 0, 0, .10);

  /* Typography */
  --font-sans: 'DM Sans', sans-serif;
  --font-serif: 'DM Serif Display', serif;

  --ease: cubic-bezier(.4, 0, .2, 1);
}

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

html {
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font-family: inherit;
}


/* ═══════════════════════════════════════════════════
   APP SHELL
════════════════════════════════════════════════════ */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}


/* ═══════════════════════════════════════════════════
   SIDEBAR  — identical dark skin as Notes app
════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  z-index: 50;
  transition: transform .3s var(--ease);
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .08) transparent;
}

/* ── Brand Header ── */
.sidebar-header {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: .55rem;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 400;
  letter-spacing: -.01em;
  color: var(--sidebar-text);
}

/* ── Stats row ── */
.sidebar-stats {
  display: flex;
  gap: .5rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.stat-card {
  flex: 1;
  background: rgba(255, 255, 255, .05);
  border-radius: var(--radius-md);
  padding: .75rem .5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
}

.stat-number {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.stat-label {
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--sidebar-muted);
}

/* ── Filter label ── */
.filter-label {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  padding: 1rem 1.25rem .5rem;
}

/* ── Filter nav ── */
.filter-nav {
  display: flex;
  flex-direction: column;
  padding: 0 .75rem;
  gap: .2rem;
}

.filter-btn {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .7rem .75rem;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--sidebar-muted);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
  text-align: left;
  border-left: 2px solid transparent;
}

.filter-btn i {
  width: 16px;
  text-align: center;
  font-size: .8rem;
}

.filter-btn:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

.filter-btn.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text);
  border-left-color: var(--accent);
}

.filter-badge {
  margin-left: auto;
  background: rgba(236, 91, 19, .22);
  color: var(--accent);
  font-size: .68rem;
  font-weight: 700;
  border-radius: 20px;
  padding: .1rem .45rem;
  min-width: 1.4rem;
  text-align: center;
}

/* ── Divider ── */
.sidebar-divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, .06);
  margin: 1rem 1.25rem;
}

/* ── Clear completed ── */
.clear-btn {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: 0 .75rem 1.5rem;
  padding: .65rem .75rem;
  border: 1px solid rgba(220, 38, 38, .25);
  background: transparent;
  border-radius: var(--radius-sm);
  color: #F87171;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.clear-btn i {
  font-size: .8rem;
}

.clear-btn:hover {
  background: rgba(220, 38, 38, .12);
  color: #FCA5A5;
}


/* ═══════════════════════════════════════════════════
   MAIN PANEL
════════════════════════════════════════════════════ */
.main-panel {
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-width: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ── Top bar ── */
.panel-topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 10;
}

.panel-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -.01em;
}

/* ── Add task bar ── */
.add-task-bar {
  padding: 1.5rem 2rem 0;
}

.add-task-form {
  display: flex;
  gap: .75rem;
}

.task-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: .75rem 1rem;
  font-size: .95rem;
  color: var(--text-primary);
  background: var(--surface-alt);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.task-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(236, 91, 19, .12);
}

.task-input::placeholder {
  color: var(--text-muted);
}

/* ── Task list meta ── */
.task-list-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem .75rem;
}

.task-list-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.task-count-badge {
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .7rem;
  font-weight: 700;
  border-radius: 20px;
  padding: .15rem .5rem;
  min-width: 1.5rem;
  text-align: center;
}

/* ── Task list ── */
.task-list {
  padding: 0 2rem 6rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

/* ── Empty state ── */
.empty-tasks {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: 4rem 2rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-tasks .empty-icon {
  font-size: 2rem;
  color: var(--accent);
  opacity: .3;
}

.empty-tasks strong {
  font-size: .95rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.empty-tasks p {
  font-size: .85rem;
  line-height: 1.6;
}

/* ── Todo item ── */
.todo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .95rem 1rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  transition: box-shadow .15s, border-color .15s;
  cursor: pointer;
}

.todo-item:hover {
  box-shadow: var(--shadow-md);
  border-color: #D4D1CA;
}

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

/* Left */
.todo-left {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex: 1;
  min-width: 0;
}

/* Circle checkbox */
.todo-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.todo-circle:hover {
  border-color: #22c55e;
}

.todo-circle.checked {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
  font-size: .65rem;
}

/* Text */
.todo-text {
  font-size: .95rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  transition: color .15s, opacity .15s;
}

.todo-text.done {
  text-decoration: line-through;
  color: var(--text-muted);
  opacity: .7;
}

/* Actions */
.todo-actions {
  display: flex;
  align-items: center;
  gap: .3rem;
  flex-shrink: 0;
  transition: opacity .15s;
}

@media (min-width: 640px) {
  .todo-actions {
    opacity: 0;
  }
}

.todo-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: .85rem;
  transition: background .15s, color .15s;
}

.todo-btn-edit:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.todo-btn-delete:hover {
  color: #DC2626;
  background: #FEF2F2;
}


/* ═══════════════════════════════════════════════════
   SHARED BUTTONS
════════════════════════════════════════════════════ */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: .65rem 1.25rem;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .4rem;
  white-space: nowrap;
  transition: background .2s, transform .1s;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:active {
  transform: scale(.97);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .65rem 1.25rem;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s;
  white-space: nowrap;
}

.btn-ghost:hover {
  background: var(--surface-alt);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, .08);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--sidebar-text);
  transition: background .2s;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, .14);
}

/* Light variant (inside modal / main panel) */
.icon-btn.light {
  background: var(--surface-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.icon-btn.light:hover {
  background: var(--border);
  color: var(--text-primary);
}

/* Mobile back — hidden on desktop */
.mobile-back {
  display: none;
}


/* ═══════════════════════════════════════════════════
   FAB  (mobile only)
════════════════════════════════════════════════════ */
.fab {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 1.2rem;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(236, 91, 19, .5);
  z-index: 200;
  transition: background .2s, transform .2s;
}

.fab:hover {
  background: var(--accent-hover);
  transform: scale(1.07);
}

.fab:active {
  transform: scale(.94);
}


/* ═══════════════════════════════════════════════════
   EDIT MODAL
════════════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(4px);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: var(--shadow-lg);
  animation: modalIn .22s var(--ease);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(.97);
  }

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

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

.modal-heading {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 400;
  color: var(--text-primary);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.form-label {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: .75rem 1rem;
  font-size: .95rem;
  color: var(--text-primary);
  background: var(--surface-alt);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(236, 91, 19, .12);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.modal-footer {
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
}


/* ═══════════════════════════════════════════════════
   MOBILE  (≤ 768px)
════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  .app-shell {
    position: relative;
    overflow: hidden;
  }

  .sidebar {
    position: absolute;
    inset: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    transform: translateX(0);
    transition: transform .3s var(--ease);
    z-index: 40;
  }

  .main-panel {
    position: absolute;
    inset: 0;
    transform: translateX(100%);
    transition: transform .3s var(--ease);
    z-index: 41;
    background: var(--surface);
  }

  /* When a filter is chosen on mobile, slide in main panel */
  .app-shell.panel-open .sidebar {
    transform: translateX(-30%);
  }

  .app-shell.panel-open .main-panel {
    transform: translateX(0);
  }

  .fab {
    display: flex;
  }

  .mobile-back {
    display: flex;
  }

  .add-task-bar {
    padding: 1rem 1.25rem 0;
  }

  .task-list {
    padding: 0 1.25rem 6rem;
  }

  .task-list-meta {
    padding: 1rem 1.25rem .6rem;
  }

  .panel-topbar {
    padding: 1rem 1.25rem;
  }

  /* Bottom-sheet modal on small phones */
  @media (max-width: 480px) {
    .modal-overlay {
      align-items: flex-end;
      padding: 0;
    }

    .modal-card {
      border-radius: var(--radius-lg) var(--radius-lg) 0 0;
      max-height: 90vh;
      animation: slideUp .25s var(--ease);
    }

    @keyframes slideUp {
      from {
        transform: translateY(100%);
      }

      to {
        transform: translateY(0);
      }
    }
  }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
  :root {
    --sidebar-w: 240px;
  }
}

/* Large screen */
@media (min-width: 1400px) {
  :root {
    --sidebar-w: 320px;
  }

  .task-list {
    padding: 0 3rem 6rem;
  }

  .add-task-bar {
    padding: 1.5rem 3rem 0;
  }

  .task-list-meta {
    padding: 1.25rem 3rem .75rem;
  }

  .panel-topbar {
    padding: 1.25rem 3rem;
  }
}