/* ─── CSS Variables ─────────────────────────────────────────── */
:root {
  --bg: #0f0f13;
  --surface: #17171e;
  --surface2: #1f1f29;
  --border: #2a2a38;
  --accent: #e8c97e;
  --accent-dim: #c9a94e;
  --accent-glow: rgba(232, 201, 126, 0.12);
  --text: #eeeaf2;
  --text-muted: #7b7a8e;
  --text-faint: #44435a;
  --danger: #e07070;
  --success: #72c98f;
  --info: #7ab0e0;
  --radius: 14px;
  --sidebar-w: 260px;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --secondary: #2b2f3d;
  --secondary-hover: #363b4d;
  --secondary-text: #cfd3e3;
}

/* ─── Reset ─────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  height: 100%;
}
body {
  font-family: "Sora", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}
input,
textarea,
select {
  font-family: inherit;
}

/* ─── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 99px;
}

/* ════════════════════════════════════════════════════════════
       AUTH SCREEN
    ════════════════════════════════════════════════════════════ */
#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  padding: 16px;
}

/* decorative blobs */
#auth-screen::before,
#auth-screen::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
}
#auth-screen::before {
  width: 500px;
  height: 500px;
  background: rgba(232, 201, 126, 0.07);
  top: -150px;
  right: -100px;
}
#auth-screen::after {
  width: 400px;
  height: 400px;
  background: rgba(122, 176, 224, 0.06);
  bottom: -100px;
  left: -80px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 48px 44px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5);
  animation: cardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

.auth-logo {
  font-family: "Playfair Display", serif;
  font-size: 28px;
  color: var(--accent);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}
.auth-logo span {
  color: var(--text-muted);
  font-size: 14px;
  font-family: "Sora", sans-serif;
  font-weight: 300;
  display: block;
  margin-top: 2px;
}

/* Tab switcher */
.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface2);
  border-radius: 10px;
  padding: 4px;
  margin: 28px 0 32px;
}
.auth-tab {
  flex: 1;
  padding: 9px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
  text-align: center;
}
.auth-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.auth-tab:hover:not(.active) {
  color: var(--text);
}

/* Forms */
.auth-form {
  display: none;
  flex-direction: column;
  gap: 16px;
}
.auth-form.active {
  display: flex;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.form-field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.form-field input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 14px;
  transition: var(--transition);
  outline: none;
  width: 100%;
}
.form-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-field input::placeholder {
  color: var(--text-faint);
}

.btn-primary {
  background: var(--accent);
  color: #1a1508;
  border-radius: 10px;
  padding: 13px;
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
  margin-top: 6px;
  width: 100%;
}

.btn-primary:hover {
  background: var(--accent-dim);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(232, 201, 126, 0.25);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-text);
  border-radius: 10px;
  padding: 13px;
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
  margin-top: 6px;
  width: 100%;
}

.btn-secondary:hover {
  background: var(--secondary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(232, 201, 126, 0.25);
}

/* Auth error / message */
#auth-message {
  display: none;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 8px;
  margin-top: 4px;
}
#auth-message.error {
  background: rgba(224, 112, 112, 0.12);
  color: var(--danger);
  border: 1px solid rgba(224, 112, 112, 0.25);
}
#auth-message.success {
  background: rgba(114, 201, 143, 0.12);
  color: var(--success);
  border: 1px solid rgba(114, 201, 143, 0.25);
}

/* ════════════════════════════════════════════════════════════
       MAIN APP LAYOUT
    ════════════════════════════════════════════════════════════ */
#app {
  display: none; /* JS: set to 'flex' after login */
  height: 100vh;
  height: 100dvh;
}
#app.visible {
  display: flex;
}

/* ─── Sidebar ────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 16px;
  gap: 6px;
  overflow-y: auto;
  transition: var(--transition);
}

.sidebar-logo {
  font-family: "Playfair Display", serif;
  font-size: 30px;
  color: var(--accent);
  padding: 0 10px 20px;
  letter-spacing: -0.3px;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-faint);
  padding: 12px 10px 6px;
}

/* Nav items */
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  color: var(--text-muted);
  font-weight: 400;
  font-size: 13.5px;
  transition: var(--transition);
  position: relative;
  cursor: pointer;
}
.nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}
.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 500;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-badge {
  margin-left: auto;
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  min-width: 22px;
  text-align: center;
}
.nav-item.active .nav-badge {
  background: var(--accent-glow);
  color: var(--accent);
}

/* Sidebar spacer + user profile at bottom */
.sidebar-spacer {
  flex: 1;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border);
  margin-top: 8px;
}
.sidebar-user:hover {
  background: var(--surface2);
  border-color: var(--text-faint);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #1a1508;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  /* JS: set text to initials */
}
.user-info {
  flex: 1;
  min-width: 0;
}
.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* JS: populate */
}
.user-email {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* JS: populate */
}

/* Logout button inside user section */
#btn-logout {
  color: var(--text-faint);
  padding: 4px;
  border-radius: 6px;
  transition: var(--transition);
  flex-shrink: 0;
}
#btn-logout:hover {
  color: var(--danger);
}
#btn-logout svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

/* ─── Main Content ───────────────────────────────────────── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* Sidebar overlay (mobile backdrop) — only visible within mobile MQ */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
  z-index: 49;
  animation: fadeIn 0.18s ease both;
}

/* Hamburger menu button */
#btn-menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: var(--transition);
  flex-shrink: 0;
}
#btn-menu-toggle:hover {
  background: var(--surface2);
  border-color: var(--text-faint);
}
#btn-menu-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Top bar */
#topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 32px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#view-title {
  font-family: "Playfair Display", serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

/* Search bar */
.search-wrap {
  position: relative;
  width: 220px;
}
.search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  stroke: var(--text-faint);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}
#search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px 9px 36px;
  color: var(--text);
  font-size: 13px;
  width: 100%;
  outline: none;
  transition: var(--transition);
}
#search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
#search-input::placeholder {
  color: var(--text-faint);
}

/* Add task button */
#btn-add-task {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #1a1508;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  flex-shrink: 0;
}
#btn-add-task:hover {
  background: var(--accent-dim);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(232, 201, 126, 0.22);
}
#btn-add-task svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
}

/* Task list area */
#task-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
}

/* Empty state */
#empty-state {
  display: none; /* JS: show when no tasks */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 14px;
  color: var(--text-faint);
  text-align: center;
  padding-bottom: 60px;
}
#empty-state svg {
  width: 52px;
  height: 52px;
  stroke: var(--text-faint);
  fill: none;
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.5;
}
#empty-state h3 {
  font-size: 17px;
  color: var(--text-muted);
  font-weight: 500;
}
#empty-state p {
  font-size: 13px;
  max-width: 240px;
  line-height: 1.7;
}

/* ─── Loading Spinner ────────────────────────────────────── */
#loading-spinner {
  display: none; /* JS: show/hide */
  justify-content: center;
  align-items: center;
  padding: 48px;
}
.spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ─── Task Cards ─────────────────────────────────────────── */
#task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* JS: append .task-card elements here */
}

/* Template: .task-card — clone this in JS */
.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition);
  cursor: pointer;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.task-card:hover {
  border-color: var(--text-faint);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.task-card.completed {
  opacity: 0.5;
}
.task-card.completed .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Checkbox */
.task-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.task-check:hover {
  border-color: var(--accent);
}
.task-check.done {
  background: var(--accent);
  border-color: var(--accent);
}
.task-check.done svg {
  display: block;
}
.task-check svg {
  display: none;
  width: 11px;
  height: 11px;
  stroke: #1a1508;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.task-body {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 5px;
  /* JS: set text to task.Title */
}

.task-description {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 10px;
  overflow: hidden;
  display: -webkit-box;
  /* -webkit-line-clamp: 2; */
  -webkit-box-orient: vertical;
  /* JS: set text to task.Description */
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.task-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 99px;
}
.task-tag.due {
  background: rgba(122, 176, 224, 0.12);
  color: var(--info);
}
.task-tag.overdue {
  background: rgba(224, 112, 112, 0.12);
  color: var(--danger);
}
.task-tag.today {
  background: rgba(232, 201, 126, 0.12);
  color: var(--accent);
}
.task-tag svg {
  width: 11px;
  height: 11px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Status pill */
.task-status {
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--surface2);
  color: var(--text-muted);
  /* JS: style based on StatusName */
}

/* Important star */
.task-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-icon:hover {
  background: var(--surface2);
  color: var(--text-muted);
}
.btn-icon.star:hover {
  color: var(--accent);
}
.btn-icon.star.active {
  color: var(--accent);
}
.btn-icon.del:hover {
  color: var(--danger);
}
.btn-icon svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn-icon.star.active svg {
  fill: var(--accent);
}

/* ════════════════════════════════════════════════════════════
       TASK MODAL (Add / Edit)
    ════════════════════════════════════════════════════════════ */
#modal-overlay {
  display: none; /* JS: show/hide */
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.18s ease both;
}
#modal-overlay.open {
  display: flex;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

#task-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 36px 32px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
  position: relative;
}
@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.modal-title {
  font-family: "Playfair Display", serif;
  font-size: 20px;
  color: var(--text);
}
.btn-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
}
.btn-close:hover {
  background: var(--surface2);
  color: var(--text);
}
.btn-close svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.modal-field label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.modal-input,
.modal-textarea,
.modal-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--text);
  font-size: 14px;
  transition: var(--transition);
  outline: none;
  width: 100%;
}
.modal-input:focus,
.modal-textarea:focus,
.modal-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.modal-input::placeholder,
.modal-textarea::placeholder {
  color: var(--text-faint);
}
.modal-textarea {
  resize: vertical;
  min-height: 88px;
}
.modal-select option {
  background: var(--surface2);
}

.modal-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Toggle: IsImportant */
.toggle-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 16px;
}
.toggle-label {
  font-size: 13.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 9px;
}
.toggle-label svg {
  width: 16px;
  height: 16px;
  stroke: var(--accent);
  fill: var(--accent);
}

.toggle-switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: var(--transition);
}
.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition);
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: #1a1508;
}

/* Modal error */
#modal-error {
  display: none;
  font-size: 12.5px;
  padding: 9px 13px;
  border-radius: 8px;
  background: rgba(224, 112, 112, 0.12);
  color: var(--danger);
  border: 1px solid rgba(224, 112, 112, 0.25);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}
.btn-ghost {
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
}
.btn-ghost:hover {
  background: var(--surface2);
  color: var(--text);
}

.btn-submit {
  background: var(--accent);
  color: #1a1508;
  border-radius: 10px;
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 7px;
}
.btn-submit:hover {
  background: var(--accent-dim);
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(232, 201, 126, 0.22);
}
.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ════════════════════════════════════════════════════════════
       TOAST NOTIFICATIONS
    ════════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 999;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 18px;
  font-size: 13.5px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
  pointer-events: auto;
  max-width: 300px;
}
.toast.removing {
  animation: toastOut 0.25s ease forwards;
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(30px);
  }
}

.toast-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.toast.success .toast-icon {
  color: var(--success);
}
.toast.error .toast-icon {
  color: var(--danger);
}
.toast.info .toast-icon {
  color: var(--info);
}
.toast-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ════════════════════════════════════════════════════════════
       CONFIRM DIALOG
    ════════════════════════════════════════════════════════════ */
#confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
#confirm-overlay.open {
  display: flex;
}

#confirm-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  animation: modalIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.confirm-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(224, 112, 112, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}
.confirm-icon svg {
  width: 22px;
  height: 22px;
  stroke: var(--danger);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}
.confirm-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 10px;
}
.confirm-body {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 26px;
}
.confirm-actions {
  display: flex;
  gap: 10px;
}
.btn-danger {
  flex: 1;
  padding: 11px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  background: var(--danger);
  color: #fff;
  transition: var(--transition);
}
.btn-danger:hover {
  opacity: 0.88;
}
.btn-cancel {
  flex: 1;
  padding: 11px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  background: var(--surface2);
  color: var(--text-muted);
  transition: var(--transition);
}
.btn-cancel:hover {
  background: var(--border);
  color: var(--text);
}

/* ════════════════════════════════════════════════════════════
       PROFILE PANEL (slide-in)
    ════════════════════════════════════════════════════════════ */
#profile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
  z-index: 150;
}
#profile-overlay.open {
  display: block;
}

#profile-panel {
  position: fixed;
  right: -420px;
  top: 0;
  bottom: 0;
  width: 380px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 32px 28px;
  z-index: 151;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
#profile-panel.open {
  right: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-title {
  font-family: "Playfair Display", serif;
  font-size: 20px;
}

.profile-avatar-lg {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  color: #1a1508;
  font-weight: 700;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px auto 0;
}

.profile-divider {
  height: 1px;
  background: var(--border);
}

/* JS NOTE: all input IDs are prefixed profile- for the edit user form */

/* ════════════════════════════════════════════════════════════
       RESPONSIVE
    ════════════════════════════════════════════════════════════ */

/* ─── Tablet (≤ 1024px) ──────────────────────────────────── */
@media (max-width: 1024px) {
  :root {
    --sidebar-w: 220px;
  }
  #sidebar {
    padding: 24px 12px;
  }
  .sidebar-logo {
    font-size: 26px;
    padding: 0 8px 16px;
  }
  #topbar {
    padding: 18px 22px;
    gap: 12px;
  }
  #view-title {
    font-size: 22px;
  }
  .search-wrap {
    width: 180px;
  }
  #task-area {
    padding: 20px 22px;
  }
}

/* ─── Mobile (≤ 768px) ───────────────────────────────────── */
@media (max-width: 768px) {
  /* Sidebar becomes an off-canvas drawer */
  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 50;
    width: 272px;
    max-width: 82vw;
    min-width: 0;
    padding: 24px 14px;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }
  #sidebar.open {
    transform: translateX(0);
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.5);
  }
  #sidebar-overlay.open {
    display: block;
  }

  /* Show hamburger */
  #btn-menu-toggle {
    display: inline-flex;
  }

  /* Top bar wraps: [menu] [title] [add] / [search spans full width] */
  #topbar {
    flex-wrap: wrap;
    padding: 14px 18px;
    gap: 10px 12px;
    row-gap: 10px;
  }
  #view-title {
    font-size: 20px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .search-wrap {
    order: 3;
    flex-basis: 100%;
    width: 100%;
  }
  #search-input {
    padding: 11px 14px 11px 36px;
    font-size: 14px;
  }
  #btn-add-task {
    padding: 10px 14px;
  }

  #task-area {
    padding: 16px 18px;
  }

  /* Task cards compact on mobile */
  .task-card {
    padding: 14px 14px;
    gap: 12px;
    border-radius: 12px;
  }
  .task-title {
    font-size: 14px;
  }
  .task-description {
    font-size: 12px;
  }
  .task-actions {
    gap: 2px;
  }
  .btn-icon {
    width: 36px;
    height: 36px;
  }

  /* Modal */
  #task-modal {
    max-width: 100%;
    padding: 22px 20px 20px;
    margin: 12px;
    max-height: calc(100dvh - 24px);
    border-radius: 18px;
  }
  .modal-header {
    margin-bottom: 20px;
  }
  .modal-title {
    font-size: 18px;
  }
  .modal-body {
    gap: 14px;
  }
  .modal-row {
    grid-template-columns: 1fr;
  }
  .modal-footer {
    padding-top: 18px;
    gap: 8px;
  }
  .btn-ghost,
  .btn-submit {
    flex: 1;
    justify-content: center;
    padding: 11px 14px;
  }

  /* Profile panel */
  #profile-panel {
    width: 340px;
    max-width: 88vw;
    right: -100%;
    padding: 24px 22px;
  }

  /* Confirm dialog */
  #confirm-dialog {
    margin: 16px;
    padding: 26px 22px;
  }

  /* Toast */
  #toast-container {
    right: 14px;
    left: 14px;
    bottom: 14px;
    align-items: flex-end;
  }
  .toast {
    max-width: 100%;
  }

  /* Auth card */
  .auth-card {
    padding: 36px 28px;
    border-radius: 20px;
  }
}

/* ─── Small mobile (≤ 480px) ─────────────────────────────── */
@media (max-width: 480px) {
  body {
    font-size: 13.5px;
  }

  /* Hide "Add Task" label, keep only the + icon */
  #btn-add-task {
    padding: 10px 12px;
  }
  #btn-add-task .btn-label {
    display: none;
  }
  #btn-add-task svg {
    width: 17px;
    height: 17px;
  }

  #view-title {
    font-size: 18px;
  }

  #topbar {
    padding: 12px 14px;
    gap: 8px 10px;
  }
  #task-area {
    padding: 14px;
  }

  /* Profile panel full-width */
  #profile-panel {
    width: 100%;
    max-width: 100%;
    padding: 22px 18px;
  }

  /* Auth card — tighter padding */
  #auth-screen {
    padding: 12px;
  }
  .auth-card {
    padding: 28px 22px;
    border-radius: 18px;
  }
  .auth-logo {
    font-size: 24px;
  }
  .auth-tabs {
    margin: 22px 0 24px;
  }

  /* Confirm dialog */
  #confirm-dialog {
    padding: 22px 18px;
    border-radius: 16px;
  }
  .confirm-actions {
    flex-direction: column-reverse;
  }

  /* Task card: hide status pill on very small, keep the tag + actions */
  .task-card {
    padding: 13px 12px;
    gap: 10px;
  }
  .task-meta {
    gap: 6px;
  }
  .task-tag,
  .task-status {
    font-size: 11px;
    padding: 2px 7px;
  }

  /* Modal */
  #task-modal {
    margin: 8px;
    padding: 20px 16px 16px;
    border-radius: 16px;
    max-height: calc(100dvh - 16px);
  }
  .modal-input,
  .modal-textarea,
  .modal-select {
    font-size: 16px; /* prevent iOS zoom on focus */
    padding: 11px 13px;
  }
  .form-field input {
    font-size: 16px;
  }
  #search-input {
    font-size: 16px;
  }
}

/* ─── Landscape small height (phones rotated) ───────────── */
@media (max-height: 500px) and (orientation: landscape) {
  #task-modal {
    max-height: calc(100dvh - 16px);
  }
  .auth-card {
    padding: 24px 28px;
  }
}
