/* ── Design Tokens ── */
:root {
  --bg-primary: #faf9f8;
  --bg-card: #ffffff;
  --bg-sidebar: #f0f3ef;
  --bg-sidebar-hover: #e2e7e0;
  --bg-sidebar-active: #d9e7d5;
  --bg-hover: #f5f5f5;
  --bg-subtle: #fafafa;
  --text-primary: #1e1e1e;
  --text-secondary: #666666;
  --text-tertiary: #999999;
  --text-sidebar: #333333;
  --text-sidebar-muted: #777777;
  --accent: #3d8b5f;
  --accent-hover: #2f6e4a;
  --accent-subtle: #edf7f1;
  --accent-muted: #c3e0ce;
  --accent-glow: none;
  --positive: #3d8b5f;
  --positive-bg: #edf7f1;
  --positive-border: #c3e0ce;
  --urgent: #d93025;
  --urgent-bg: #fce8e6;
  --urgent-border: #f5c6c2;
  --warning: #e37400;
  --warning-bg: #fef7e0;
  --warning-border: #fdd663;
  --border: #e8e8e8;
  --border-light: #f0f0f0;
  --border-sidebar: #e0e3de;
  --shadow-sm: none;
  --shadow-md: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --sidebar-w: 248px;
  --detail-w: 340px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

input, textarea, select, button {
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-primary);
}

input, textarea, select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text-primary);
}

input::placeholder, textarea::placeholder { color: var(--text-tertiary); }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: none;
}
button { cursor: pointer; }
.hidden { display: none !important; }

/* ── Typography Scale ── */
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; font-weight: 650; letter-spacing: -0.01em; }

/* ── Auth Pages ── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    var(--bg-primary);
}

.auth-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 44px 36px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border);
}

.auth-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.auth-card h1::before {
  content: '';
  display: block;
  width: 40px;
  height: 3px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  border-radius: 2px;
  margin: 0 auto 16px;
  box-shadow: var(--accent-glow);
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 24px;
}

.auth-card input {
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  transition: border-color 0.2s, box-shadow 0.2s;
  font-size: 0.95rem;
}

.auth-card input::placeholder { color: var(--text-tertiary); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.2s, transform 0.1s;
  letter-spacing: 0.01em;
}

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

.alert-error {
  background: var(--urgent-bg);
  color: var(--urgent);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 0.88rem;
  border: 1px solid var(--urgent-border);
}

.alert-success {
  background: var(--positive-bg);
  color: var(--positive);
  padding: 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
  border: 1px solid var(--positive-border);
}

.auth-link {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ── App Layout ── */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-sidebar);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
  color: var(--text-sidebar);
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--border);
}

.detail-panel {
  width: 0;
  background: var(--bg-card);
  border-left: none;
  overflow-y: auto;
  flex-shrink: 0;
  opacity: 0;
  transition: width 0.25s ease, opacity 0.25s ease, border-left 0.25s ease;
}

.detail-panel.active {
  width: var(--detail-w);
  opacity: 1;
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-tertiary);
  font-size: 0.92rem;
  text-align: center;
  padding: 32px;
  gap: 8px;
}

.detail-empty::before {
  content: '';
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-subtle);
  margin-bottom: 8px;
  opacity: 0.6;
}

/* ── Sidebar ── */
.sidebar-nav {
  padding: 20px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 20px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  font-weight: 600;
  flex-shrink: 0;
}

.sidebar-user span {
  font-weight: 550;
  font-size: 0.92rem;
  color: var(--text-sidebar);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-link {
  margin-left: auto;
  font-size: 1rem;
  color: var(--text-sidebar-muted);
  transition: color 0.15s;
  padding: 4px;
  border-radius: 6px;
}

.settings-link:hover { color: var(--text-sidebar); background: var(--bg-sidebar-hover); }

.sidebar-search { padding: 0 4px 12px 4px; }
.search-input {
  width: 100%;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  background: #fff;
  color: var(--text-primary);
}
.search-input::placeholder { color: var(--text-tertiary); }
.search-input:focus { border-color: var(--accent); box-shadow: none; }

.nav-section { margin-bottom: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-sidebar);
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  text-decoration: none;
  font-weight: 470;
}

.nav-item:hover { background: var(--bg-sidebar-hover); color: #fff; }

.nav-item.active {
  background: var(--bg-sidebar-active);
  color: var(--text-primary);
  font-weight: 580;
}

.nav-item.active .nav-dot.accent { box-shadow: 0 0 0 3px hsla(250,35%,50%,0.4); }
.nav-item.active .nav-dot.warning { box-shadow: 0 0 0 3px hsla(35,55%,48%,0.4); }
.nav-item.active .nav-dot.info { box-shadow: 0 0 0 3px rgba(96,165,250,0.3); }
.nav-item.active .nav-dot.purple { box-shadow: 0 0 0 3px rgba(167,139,250,0.3); }

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

.nav-item .nav-dot.accent { background: var(--accent); }
.nav-item .nav-dot.warning { background: var(--warning); }
.nav-item .nav-dot.info { background: #60A5FA; }
.nav-item .nav-dot.purple { background: #A78BFA; }

.list-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.nav-count {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-sidebar);
  background: rgba(0,0,0,0.08);
  padding: 1px 8px;
  border-radius: 9px;
  min-width: 22px;
  text-align: center;
  line-height: 1.6;
}

.member-badge {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--text-tertiary);
}

.nav-divider {
  height: 1px;
  background: var(--border-sidebar);
  margin: 14px 4px;
}

.nav-group { margin-bottom: 2px; }

.nav-group summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 0.9rem;
  font-weight: 550;
  cursor: pointer;
  list-style: none;
  color: var(--text-sidebar);
  border-radius: var(--radius-sm);
}

.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary:hover { background: var(--bg-sidebar-hover); color: #fff; }

.nav-sublist {
  padding-left: 36px;
  font-size: 0.875rem;
  font-weight: 440;
}

.nav-add-btn {
  background: none;
  border: 1px dashed var(--border-sidebar);
  color: var(--text-sidebar-muted);
  font-size: 0.875rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  width: 100%;
  text-align: left;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  margin-top: 4px;
}

.nav-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg-sidebar-hover);
}

#new-list-form {
  padding: 8px 0;
  display: flex;
  gap: 6px;
}

#new-list-form input {
  flex: 1;
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  background: var(--bg-card);
}

#new-list-form button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 550;
}

.logout-form { padding: 14px; }

.logout-btn {
  width: 100%;
  padding: 9px;
  background: none;
  border: 1px solid var(--border-sidebar);
  border-radius: var(--radius-sm);
  color: var(--text-sidebar-muted);
  font-size: 0.875rem;
  transition: background 0.15s, color 0.15s;
}

.logout-btn:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-primary);
}

/* ── Mobile Header ── */
.mobile-header {
  display: none;
  padding: 10px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.mobile-header span {
  font-weight: 600;
  font-size: 1rem;
}

.mobile-header span:last-child {
  margin-left: auto;
  font-weight: 470;
  color: var(--text-sidebar-muted);
  font-size: 0.9rem;
}

.hamburger {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-sidebar);
  font-size: 1.1rem;
  color: var(--text-primary);
  display: none;
  padding: 4px 8px;
  border-radius: 6px;
}

.hamburger:hover { background: var(--bg-hover); border-color: rgba(255,255,255,0.15); }

/* ── Task List Area ── */
.task-list-area {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

.task-list-header {
  margin-bottom: 24px;
}

.task-list-title-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.task-list-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  flex: 0 0 auto;
}






/* Smart view header accents */
.task-list-header h2.view-myday { color: var(--accent); }
.task-list-header h2.view-important { color: var(--warning); }
.task-list-header h2.view-planned { color: #60A5FA; }

.list-header-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

/* ── Task Rows ── */
.task-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  animation: task-enter 0.3s ease-out;
}

.task-row:hover {
  background: var(--bg-hover);
}

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

.task-row:hover {
  background: #FDFDFE;
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

/* Completed task styling */
.task-row.completed {
  background: transparent;
  border-color: transparent;
}

.task-row.completed:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.task-row.completed .task-title {
  text-decoration: line-through;
  color: var(--text-tertiary);
  transition: color 0.3s, text-decoration-color 0.3s;
  text-decoration-color: var(--text-tertiary);
  text-decoration-thickness: 1.5px;
}

/* Check circle */
.task-check-form { display: flex; align-items: center; }

.task-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--text-tertiary);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
  padding: 0;
  color: #fff;
  transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
}

.task-check:hover {
  border-color: var(--positive);
  background: var(--positive-bg);
}

.task-check.checked {
  background: var(--positive);
  border-color: var(--positive);
  animation: check-pop 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes check-pop {
  0% { transform: scale(0.8); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Task info */
.task-info {
  flex: 1;
  cursor: pointer;
  min-width: 0;
  padding: 2px 0;
}

.task-title {
  display: block;
  font-size: 0.94rem;
  font-weight: 490;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.task-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
  font-size: 0.78rem;
}

/* Due date pills */
.due-pill {
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 520;
  letter-spacing: 0.01em;
}

.due-pill.overdue {
  background: var(--urgent-bg);
  color: var(--urgent);
  border: 1px solid var(--urgent-border);
}

.due-pill.today {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.due-pill.future {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

/* Meta indicators */
.task-meta .meta-important {
  color: var(--warning);
  font-size: 0.8rem;
}

.task-meta .meta-subtask {
  color: var(--text-tertiary);
  font-size: 0.78rem;
}

.task-meta .meta-recur {
  color: var(--text-tertiary);
  font-size: 0.78rem;
}

/* Star toggle button */
.task-star-btn {
  background: none;
  border: none;
  font-size: 0.95rem;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--text-tertiary);
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
  line-height: 1;
}

.task-star-btn:hover {
  color: var(--warning);
  background: var(--warning-bg);
}

.task-star-btn.active { color: var(--warning); }

/* ── Quick Add ── */
.quick-add {
  display: flex;
  gap: 8px;
  padding: 20px 0;
}

.quick-add input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 0.92rem;
  transition: border-color 0.2s, background 0.2s;
}

.quick-add input::placeholder { color: var(--text-tertiary); }

.quick-add input:focus {
  border-color: var(--accent);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px hsla(250,35%,50%,0.1);
}

.quick-add button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0 18px;
  font-size: 1.1rem;
  font-weight: 500;
  transition: background 0.2s, transform 0.15s;
}

.quick-add button:hover { background: var(--accent-hover); }
.quick-add button:active { transform: scale(0.97); }

/* ── Detail Panel ── */
.detail-content {
  padding: 24px 20px;
}

.detail-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.detail-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--text-tertiary);
  padding: 6px 8px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.detail-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.detail-form { display: flex; flex-direction: column; gap: 20px; }

.detail-title-input {
  font-size: 1.2rem;
  font-weight: 650;
  border: none;
  padding: 8px 0;
  background: transparent;
  width: 100%;
  color: var(--text-primary);
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s;
  letter-spacing: -0.01em;
}

.detail-title-input:focus {
  border-bottom-color: var(--accent);
  box-shadow: var(--accent-glow);
}

.detail-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 550;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-field input,
.detail-field textarea,
.detail-field select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: var(--bg-card);
  transition: border-color 0.2s, box-shadow 0.2s;
  color: var(--text-primary);
}

.detail-field textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.5;
}

.detail-field select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748B' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* Subtasks */
.subtask-list {
  list-style: none;
  margin-bottom: 10px;
}

.subtask-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-light);
}

.subtask-item:last-child { border-bottom: none; }

.subtask-title { flex: 1; }
.subtask-title.done {
  text-decoration: line-through;
  color: var(--text-tertiary);
  text-decoration-color: var(--positive);
  text-decoration-thickness: 1.5px;
}

.add-subtask {
  display: flex;
  gap: 8px;
}

.add-subtask input {
  flex: 1;
  padding: 7px 10px;
  border: 1.5px dashed var(--border);
  border-radius: 6px;
  font-size: 0.87rem;
  background: transparent;
}

.add-subtask input:focus {
  border-style: solid;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* Detail actions */
.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.btn-action {
  width: 100%;
  padding: 9px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: left;
  font-size: 0.88rem;
  color: var(--text-secondary);
  transition: all 0.15s;
  font-weight: 470;
}

.btn-action:hover {
  background: var(--bg-hover);
  border-color: rgba(255,255,255,0.15);
  color: var(--text-primary);
}

.btn-danger { color: var(--urgent); }
.btn-danger:hover { background: var(--urgent-bg); color: var(--urgent); }

  /* ── Recurrence ── */
.recur-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
}

.recur-next-hint {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 500;
}

/* Custom recurrence popup */
.recur-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(0,0,0,0.2);
}

.recur-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.05);
  min-width: 300px;
}

.recur-popup-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 20px;
  justify-content: center;
}

.recur-popup-stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.recur-popup-stepper button {
  width: 34px; height: 34px;
  border: none;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.recur-popup-stepper button:hover { background: var(--accent-subtle); color: var(--accent); }
.recur-popup-stepper span {
  width: 40px;
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 5px 0;
}

.custom-unit {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.88rem;
  background: var(--bg-card);
  cursor: pointer;
  color: var(--text-primary);
}

.recur-popup-ok {
  width: 100%;
  padding: 10px 0;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.recur-popup-ok:hover { background: var(--accent-hover); }


/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-tertiary);
}

.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-hover);
  box-shadow: inset 0 0 20px rgba(99,102,241,0.08);
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.empty-state p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 470;
}

.empty-sub {
  font-size: 0.85rem;
  margin-top: 6px;
  color: var(--text-tertiary);
}

/* ── Version Info ── */
.version-info {
  text-align: center;
  padding: 8px 0;
  font-size: 0.68rem;
  color: var(--text-tertiary);
  opacity: 0.45;
  letter-spacing: 0.02em;
}

/* ── Settings Page ── */
.settings-page {
  padding: 32px 24px;
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  overflow-y: auto;
  height: auto;
}

.settings-container {
  background: var(--bg-card);
  padding: 36px 32px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.settings-container h1 {
  margin-bottom: 4px;
  font-size: 1.5rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 28px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: color 0.15s;
}

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

.settings-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.settings-section h2 {
  font-size: 1.1rem;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.settings-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.inline-form input {
  flex: 1;
  min-width: 140px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: var(--bg-card);
  color: var(--text-primary);
}

.inline-form .btn-primary {
  flex: 0 0 auto;
}

/* ── User Table ── */
.user-table-wrap {
  overflow-x: auto;
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.user-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border);
}

.user-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

.user-table tr:last-child td { border-bottom: none; }

.user-table tr.current-user {
  background: var(--accent-subtle);
}

.user-table tr.current-user td {
  font-weight: 550;
}

/* ── Backup Table ── */
.backup-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 0.875rem;
}

.backup-table th,
.backup-table td {
  text-align: left;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}

.backup-table th {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.key-display {
  display: block;
  padding: 12px 14px;
  background: var(--bg-card);
  border-radius: 6px;
  word-break: break-all;
  margin: 10px 0;
  font-size: 0.82rem;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  border: 1px solid var(--border-light);
}

.key-list { list-style: none; }

.key-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
}

.key-item:last-child { border-bottom: none; }

.key-date {
  color: var(--text-tertiary);
  font-size: 0.82rem;
  flex: 1;
}

.btn-backup {
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-backup:hover { background: var(--accent-hover); }
.btn-backup:active { transform: scale(0.985); }

.btn-danger-sm {
  background: none;
  border: 1px solid var(--urgent-border);
  color: var(--urgent);
  font-size: 0.82rem;
  padding: 4px 12px;
  border-radius: 6px;
  transition: background 0.15s;
}

.btn-danger-sm:hover {
  background: var(--urgent-bg);
}

/* ── Overlay ── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 10;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.overlay.show { display: block; }

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

button:focus:not(:focus-visible),
input:focus:not(:focus-visible) {
  outline: none;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

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

/* ── Mobile ── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    bottom: 0;
    z-index: 20;
    transition: left 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    width: 280px;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open { left: 0; }

  .detail-panel {
    position: fixed;
    bottom: -100%;
    left: 0;
    right: 0;
    height: 70vh;
    width: 100% !important;
    z-index: 20;
    opacity: 1;
    transition: bottom 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-left: none !important;
    box-shadow: 0 -4px 20px rgba(30,41,59,0.12);
  }

  .detail-panel.active { width: 100% !important; }
  .detail-panel.open { bottom: 0; }

  .mobile-header { display: flex; }
  .hamburger { display: block; }

  .task-list-area {
    padding: 16px 16px;
  }

  .task-list-header h2 {
    font-size: 1.25rem;
  }

  .sidebar-nav { padding: 14px 10px; }

  .settings-page {
    padding: 16px;
  }

  .settings-container {
    padding: 24px 18px;
  }

  .inline-form {
    flex-direction: column;
  }

  .auth-card {
    padding: 32px 24px;
    margin: 16px;
  }
}
