/* ============================
   Taksky — Premium Redesign
   Main color: #ef6b33
   ============================ */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap');

/* --- CSS Custom Properties --- */
:root {
  --primary: #ef6b33;
  --primary-light: #f4915f;
  --primary-dark: #d95a24;
  --primary-bg: #fef4ee;
  --primary-border: #fdd8be;
  --primary-shadow: rgba(239, 107, 51, 0.25);

  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --accent-purple: #a855f7;
  --accent-rose: #f43f5e;
  --accent-blue: #3b82f6;

  --warm-white: #fdfcf9;
  --sidebar-bg: #ffffff;
  --content-bg: #f8f9fa;
  --card-bg: #ffffff;

  --text-main: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  --border-light: #e2e8f0;
  --border-subtle: #f1f5f9;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.1);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 10px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  --sidebar-width: 280px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  height: 100%;
  height: 100dvh;
}

body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--warm-white);
  color: var(--text-main);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  text-decoration: none;
  color: inherit;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ============================
   SIDEBAR
   ============================ */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-light);
  background: var(--sidebar-bg);
  flex-shrink: 0;
  z-index: 50;
}

.sidebar-brand {
  padding: 1.75rem 1.5rem;
}

.sidebar-brand-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary), var(--accent-rose));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 12px var(--primary-shadow);
}

.brand-icon .material-symbols-outlined {
  font-size: 26px;
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-badge {
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-bg);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--primary-border);
  margin-top: 4px;
  width: fit-content;
}

/* --- Sidebar Nav --- */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0 0.75rem;
}

.nav-section {
  margin-bottom: 1.5rem;
}

.nav-section-title {
  padding: 0 0.75rem;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: #f8fafc;
  color: var(--text-main);
}

.nav-item.active {
  background: var(--primary-bg);
  color: var(--primary);
  border-color: var(--primary-border);
  font-weight: 700;
}

.nav-item .material-symbols-outlined {
  font-size: 22px;
}

.nav-item .nav-icon-amber {
  color: var(--accent-amber);
}

.nav-item .nav-icon-orange {
  color: var(--primary);
}

.nav-item .nav-icon-blue {
  color: var(--accent-blue);
}

.nav-item .nav-icon-rose {
  color: var(--accent-rose);
}

.nav-item .nav-icon-emerald {
  color: var(--accent-emerald);
}

.nav-item .nav-icon-purple {
  color: var(--accent-purple);
}

/* ============================
   ACCORDION (Groups -> Lists)
   ============================ */
.accordion-group {
  margin-bottom: 2px;
}

.accordion-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.accordion-toggle:hover {
  background: #f8fafc;
}

.accordion-toggle.open {
  background: #f8fafc;
}

.accordion-toggle-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.nav-group-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.accordion-group-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.accordion-chevron {
  font-size: 20px !important;
  color: var(--text-faint);
  transition: transform 0.25s ease;
}

.accordion-toggle.open .accordion-chevron {
  transform: rotate(180deg);
}

/* Accordion Panel */
.accordion-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding-left: 0.5rem;
}

.accordion-panel.open {
  max-height: 500px;
  padding-top: 2px;
  padding-bottom: 4px;
}

.accordion-list-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin-left: 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition);
  border-left: 2px solid transparent;
}

.accordion-list-item:hover {
  background: var(--primary-bg);
  color: var(--primary);
  border-left-color: var(--primary-light);
}

.accordion-list-item.active {
  background: var(--primary-bg);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 700;
}

.accordion-list-item .material-symbols-outlined {
  font-size: 16px;
  color: inherit;
}

/* --- Sidebar Footer --- */
.sidebar-footer {
  padding: 1.25rem;
}

.sidebar-create-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  background: var(--text-main);
  color: white;
  font-weight: 700;
  font-size: 0.875rem;
  padding: 0.8rem 1rem;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 8px 24px rgba(30, 41, 59, 0.2);
  font-family: inherit;
}

.sidebar-create-btn:hover {
  background: #334155;
  transform: translateY(-1px);
}

.sidebar-create-btn:active {
  transform: scale(0.98);
}

.sidebar-create-btn .material-symbols-outlined {
  font-size: 20px;
}

/* ============================
   MAIN CONTENT AREA
   ============================ */
.main-content {
  flex: 1;
  height: 100vh;
  height: 100dvh;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--content-bg);
  position: relative;
}

.content-header {
  display: none;
  /* hidden on desktop — only shown on mobile */
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  gap: 0.75rem;
  flex-shrink: 0;
  min-height: 56px;
  background: var(--content-bg);
  border-bottom: 1px solid var(--border-subtle);
}

.content-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.content-header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.content-header h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.75rem;
  transition: var(--transition);
}

.back-link:hover {
  color: var(--primary-dark);
}

.back-link .material-symbols-outlined {
  font-size: 18px;
}

.content-body {
  flex: 1;
  overflow-y: auto;
  /* bottom padding must clear the fixed chat bar (~140px) + safe area */
  padding: 2rem 2.5rem;
  padding-bottom: calc(140px + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
}

.content-inner {
  max-width: 900px;
  margin: 0 auto;
}

/* ============================
   SECTION HEADERS
   ============================ */
.section-block {
  margin-bottom: 3rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.section-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-2xl);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.section-icon.orange {
  background: var(--primary-bg);
  color: var(--primary);
}

.section-icon.amber {
  background: #fef3c7;
  color: #d97706;
}

.section-icon.indigo {
  background: #ffd8c5;
  color: #e6703a;
}

.section-icon.emerald {
  background: #d1fae5;
  color: #059669;
}

.section-icon.rose {
  background: #ffe4e6;
  color: #e11d48;
}

.section-icon .material-symbols-outlined {
  font-size: 28px;
  font-variation-settings: 'FILL' 1;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
}

.section-subtitle {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- Stats Pill --- */
.stats-pill {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: white;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.stats-count {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-main);
}

.stats-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stats-label.orange {
  color: var(--primary);
}

.stats-label.amber {
  color: #d97706;
}

.stats-label.indigo {
  color: #4f46e5;
}

.stats-label.emerald {
  color: #059669;
}

.stats-label.rose {
  color: #e11d48;
}

/* ============================
   TASK CARDS — Vertical Layout
   ============================ */
.tasks-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.task-card {
  background: var(--card-bg);
  border: 1px solid rgba(226, 232, 240, 0.6);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  transition: var(--transition);
  cursor: pointer;
  /* VERTICAL layout — stacks row + subtasks */
  display: flex;
  flex-direction: column;
  gap: 0;
}

.task-card:hover {
  box-shadow: 0 8px 25px rgba(239, 107, 51, 0.06);
  border-color: rgba(239, 107, 51, 0.2);
}

.task-card.task-done {
  background: rgba(248, 250, 252, 0.5);
  border-color: rgba(241, 245, 249, 1);
  opacity: 0.6;
}

/* Task row: checkbox + body + actions — horizontal */
.task-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Legacy .task-main compat */
.task-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  width: 100%;
}

/* Checkbox — custom rounded */
.task-checkbox {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  background: white;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.task-checkbox::after {
  content: '';
  display: block;
  width: 6px;
  height: 10px;
  border: 2.5px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translate(-1px, -1px);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.task-checkbox:hover {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.1);
}

.task-checkbox:checked {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.35);
}

.task-checkbox:checked::after {
  opacity: 1;
}

/* Task Body */
.task-body {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  transition: var(--transition);
  line-height: 1.4;
}

.task-card:hover .task-title {
  color: var(--primary);
}

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

.task-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.3rem;
  flex-wrap: wrap;
}

/* Badges */
.badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-group {
  background: #f3e8ff;
  color: #7c3aed;
  border: 1px solid #e9d5ff;
}

.badge-list {
  background: #d1fae5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge-current {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-pending {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.badge-static {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.task-origin {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.task-badges {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

/* Task Actions */
.task-actions {
  display: flex;
  gap: 0.15rem;
  opacity: 0;
  transition: opacity 0.2s;
  flex-shrink: 0;
}

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

.pending-reason {
  font-size: 12px;
  color: #1e40af;
  background: #dbeafe;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid #bfdbfe;
}

.done-date {
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 500;
}

.completed-indicator {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-faint);
}

.completed-indicator .material-symbols-outlined {
  font-size: 16px;
  color: var(--accent-emerald);
}

/* ============================
   SUBTASKS — Below task row
   ============================ */
.subtasks-section {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  padding-left: 2.5rem;
  border-top: 1px dashed var(--border-light);
}

.subtasks-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.subtask-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
}

.subtask-checkbox {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  background: white;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease, border-color 0.2s ease;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.subtask-checkbox::after {
  content: '';
  display: block;
  width: 4px;
  height: 7px;
  border: 2px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translate(-0.5px, -1px);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.subtask-checkbox:hover {
  border-color: var(--accent-emerald);
}

.subtask-checkbox:checked {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
}

.subtask-checkbox:checked::after {
  opacity: 1;
}

.subtask-title {
  font-size: 0.825rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.subtask-title.done {
  text-decoration: line-through;
  color: var(--text-faint);
}

.add-subtask {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.subtask-input {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  font-size: 0.825rem;
  flex: 1;
  outline: none;
  font-family: inherit;
  transition: var(--transition);
  background: var(--content-bg);
}

.subtask-input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(239, 107, 51, 0.1);
}

/* ============================
   BUTTONS
   ============================ */
.btn {
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px var(--primary-shadow);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--primary-shadow);
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.btn-danger {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.btn-danger:hover {
  background: #fee2e2;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.45rem;
  border-radius: var(--radius-md);
  transition: var(--transition);
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: #f8fafc;
  color: var(--text-secondary);
}

.btn-icon-danger:hover {
  color: #dc2626;
  background: #fef2f2;
}

.btn-icon-sm {
  font-size: 0.85rem;
  padding: 0.2rem;
}

/* ============================
   LISTS GRID (Home)
   ============================ */
.lists-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.list-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  border: 1px solid var(--border-light);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.list-card:hover {
  border-color: rgba(239, 107, 51, 0.3);
  box-shadow: 0 8px 30px rgba(239, 107, 51, 0.1);
  transform: translateY(-2px);
}

.list-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.list-card-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.list-card-footer {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.list-type-icon {
  margin-right: 0.25rem;
  font-size: 1.1rem;
}

.group-label {
  font-size: 0.8rem;
  color: var(--text-faint);
  font-weight: 500;
}

.task-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ============================
   CHAT INPUT BAR
   ============================ */
.chat-input-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem 2.5rem;
  /* include safe-area (iOS notch / home indicator) */
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--content-bg) 85%, transparent);
  z-index: 30;
  /* on desktop offset by sidebar width so bar sits only over content */
  left: var(--sidebar-width);
}

.chat-bar-inner {
  max-width: 900px;
  margin: 0 auto;
}

.chat-input-controls {
  margin-bottom: 0.5rem;
}

.chat-input-wrapper {
  background: white;
  border: 2px solid var(--primary-border);
  border-radius: var(--radius-2xl);
  padding: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 12px 40px rgba(239, 107, 51, 0.1);
  transition: var(--transition);
}

.chat-input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 12px 40px rgba(239, 107, 51, 0.18);
}

.chat-icon-left {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  margin-left: 0.5rem;
  flex-shrink: 0;
}

.chat-icon-left .material-symbols-outlined {
  font-size: 20px;
}

.chat-input-wrapper input[type="text"] {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-main);
  padding: 0.75rem 0;
  background: transparent;
}

.chat-input-wrapper input[type="text"]::placeholder {
  color: var(--text-faint);
}

.chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  box-shadow: 0 4px 12px var(--primary-shadow);
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: var(--primary-dark);
}

.chat-send-btn:active {
  transform: scale(0.95);
}

.chat-send-btn .material-symbols-outlined {
  font-size: 20px;
}

.list-selector {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  background: white;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-secondary);
  transition: var(--transition);
}

.list-selector:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(239, 107, 51, 0.1);
}

.list-selector.full-width {
  width: 100%;
  margin-bottom: 0.5rem;
}

/* ============================
   MODALS
   ============================ */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-content {
  background: white;
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 90%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }

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

.modal-content h3 {
  margin-bottom: 1.25rem;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
}

.modal-content input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  outline: none;
  margin-bottom: 1rem;
  transition: var(--transition);
  color: var(--text-main);
}

.modal-content input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(239, 107, 51, 0.1);
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.full-width {
  width: 100%;
}

/* ============================
   FLASH MESSAGE
   ============================ */
.flash-message {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: 500px;
  width: 90%;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 300;
  box-shadow: var(--shadow-lg);
  animation: flashIn 0.3s ease-out;
}

@keyframes flashIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.flash-message.success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.flash-message.error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  color: var(--text-faint);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 3rem 1rem;
}

/* ============================
   FOCUS PAGE
   ============================ */
.focus-section {
  margin-bottom: 2.5rem;
}

.focus-section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border-subtle);
}

.focus-section-header h2 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
}

.focus-section-header .section-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-faint);
  margin-left: auto;
}

.section-divider {
  border: none;
  border-top: 2px dashed var(--border-light);
  margin: 2rem 0;
}

/* Page Header compat */
.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
}

.page-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.page-header-right {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  margin-top: 0.25rem;
}

/* ============================
   MOBILE
   ============================ */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: white;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
}

.mobile-menu-btn .material-symbols-outlined {
  font-size: 24px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.3);
  z-index: 40;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    width: 280px;
    height: 100vh;
    transition: left 0.3s ease;
    z-index: 50;
    box-shadow: var(--shadow-xl);
  }

  .sidebar.open {
    left: 0;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .content-header {
    display: flex;
    /* visible on mobile */
    padding: 0.75rem 1rem;
  }

  .content-header h1 {
    font-size: 1.5rem;
  }

  .content-body {
    padding: 0.75rem 1rem;
    /* bottom padding clears the fixed chat bar on mobile */
    padding-bottom: calc(130px + env(safe-area-inset-bottom, 0px));
  }

  .chat-input-bar {
    /* full width on mobile — sidebar is hidden */
    left: 0;
    padding: 0.75rem 1rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }

  .task-actions {
    opacity: 1;
  }

  .lists-grid {
    grid-template-columns: 1fr;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .content-header h1 {
    font-size: 1.25rem;
  }

  .task-card {
    padding: 1rem;
  }

  .task-title {
    font-size: 0.85rem;
  }

  .btn {
    padding: 0.5rem 0.85rem;
    font-size: 0.8rem;
  }

  .pending-reason {
    max-width: 100%;
  }

  .subtasks-section {
    padding-left: 1.5rem;
  }
}

/* ============================
   TOKEN GATE MODAL
   ============================ */
.token-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.token-gate-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
  animation: tokenGateIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

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

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

.token-gate-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary), var(--accent-rose));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 8px 24px var(--primary-shadow);
  margin-bottom: 0.25rem;
}

.token-gate-icon .material-symbols-outlined {
  font-size: 32px;
  font-variation-settings: 'FILL' 1;
}

.token-gate-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.token-gate-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
}

.token-gate-input {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-main);
  background: var(--warm-white);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  text-align: center;
  letter-spacing: 0.05em;
}

.token-gate-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-shadow);
}

.token-gate-error {
  font-size: 0.8rem;
  color: var(--accent-rose);
  font-weight: 600;
  margin: 0;
}

.token-gate-btn {
  width: 100%;
  padding: 0.9rem 1rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 16px var(--primary-shadow);
  margin-top: 0.25rem;
}

.token-gate-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--primary-shadow);
}

.token-gate-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.token-gate-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}