:root {
  /* White & Pastel Pink Palette */
  --bg: #fff9fb;
  --surface: #ffffff;
  --surface-soft: #fff2f6;
  --surface-tint: #fce7f3;
  --border: #f8d7e6;
  --border-strong: #f3b8d4;

  --pink-50: #fff1f5;
  --pink-100: #ffe4ec;
  --pink-200: #fbcfe8;
  --pink-300: #f9a8d4;
  --pink-400: #f472b6;
  --pink-500: #ec4899;
  --pink-600: #db2777;

  --text: #3d2431;
  --text-muted: #8b6a7a;
  --text-light: #b08f9f;

  --danger: #e11d48;
  --danger-bg: #fff1f2;
  --success: #0d9488;
  --success-bg: #f0fdfa;
  --warn: #d97706;
  --warn-bg: #fffbeb;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 2px 10px rgba(236, 72, 153, 0.06);
  --shadow: 0 10px 30px rgba(236, 72, 153, 0.09);
  --shadow-lg: 0 18px 46px rgba(219, 39, 119, 0.14);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* Buttons & Inputs */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}
.btn-primary {
  background: linear-gradient(135deg, var(--pink-400), var(--pink-500));
  color: #fff;
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.25);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(236, 72, 153, 0.34);
}
.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-soft); border-color: var(--border-strong); }
.btn-danger-soft {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #fecdd3;
}
.btn-danger-soft:hover { background: #ffe4e6; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-full { width: 100%; }

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.icon-btn:hover { background: var(--surface-soft); color: var(--pink-600); border-color: var(--pink-300); }
.icon-btn.active { background: var(--pink-100); color: var(--pink-600); border-color: var(--pink-300); }

input, textarea, select {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--pink-400);
  box-shadow: 0 0 0 3px rgba(244, 114, 182, 0.16);
}
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Login Screen */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 20%, #ffe4ef 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, #fce7f3 0%, transparent 45%),
    #ffffff;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px 28px;
  box-shadow: var(--shadow-lg);
}
.brand-badge {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, #ffe4ec, #fbcfe8);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(244, 114, 182, 0.22);
}
.brand-dot { font-size: 26px; color: var(--pink-600); }
.login-card h1 { margin: 0; text-align: center; font-size: 22px; color: var(--text); }
.login-subtitle { margin: 6px 0 24px; text-align: center; font-size: 13.5px; color: var(--text-muted); }
.form-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecdd3;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}
.login-foot { margin: 18px 0 0; text-align: center; font-size: 12px; color: var(--text-light); }

/* Topbar */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ffe4ec, #f9a8d4);
  color: var(--pink-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.logo-title { font-weight: 700; font-size: 16px; line-height: 1.1; }
.logo-sub { font-size: 11px; color: var(--text-muted); }

.nav-tabs {
  display: inline-flex;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.nav-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.16s ease;
}
.nav-tab:hover { color: var(--pink-600); }
.nav-tab.active {
  background: var(--surface);
  color: var(--pink-600);
  box-shadow: var(--shadow-sm);
}

.pill {
  background: var(--pink-100);
  color: var(--pink-600);
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.pill-pink { background: #fce7f3; color: #be185d; }
.pill-done { background: var(--success-bg); color: var(--success); }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box .search-icon {
  position: absolute;
  left: 11px;
  color: var(--text-light);
  font-size: 15px;
  pointer-events: none;
}
.search-box input {
  padding-left: 32px;
  width: 230px;
  background: var(--surface-soft);
  border-color: transparent;
}
.search-box input:focus { background: var(--surface); border-color: var(--pink-400); }

.progress-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--pink-600);
}
.progress-track {
  width: 68px;
  height: 7px;
  border-radius: 999px;
  background: #fde2ee;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--pink-400), var(--pink-500));
  border-radius: 999px;
  transition: width 0.25s ease;
}
.user-menu { display: flex; align-items: center; gap: 8px; }
.user-pill {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

/* Main Content */
.main-content { flex: 1; padding: 20px 24px 32px; max-width: 1440px; width: 100%; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Notes Layout */
.notes-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  min-height: calc(100vh - 120px);
}
.notes-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(100vh - 120px);
}
.sidebar-header { padding: 16px; border-bottom: 1px solid var(--border); background: var(--bg); }
.tag-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 5px 11px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip:hover { border-color: var(--pink-300); color: var(--pink-600); }
.chip.active { background: var(--pink-500); border-color: var(--pink-500); color: #fff; }

.notes-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.note-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 14px;
  cursor: pointer;
  transition: all 0.16s ease;
  background: var(--surface);
}
.note-card:hover { border-color: var(--pink-300); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.note-card.active { border-color: var(--pink-500); box-shadow: 0 0 0 2px rgba(236, 72, 153, 0.16); }
.note-card[data-color="blush"] { background: #fff5f8; }
.note-card[data-color="rose"] { background: #ffeef4; }
.note-card[data-color="peach"] { background: #fff6f2; }
.note-card[data-color="lavender"] { background: #faf5ff; }

.note-card-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 4px; }
.note-card-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-card-pin { color: var(--pink-500); font-size: 13px; flex-shrink: 0; }
.note-card-snippet {
  font-size: 12.5px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
  line-height: 1.45;
}
.note-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 11px; color: var(--text-light); }
.mini-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.mini-tag { background: rgba(236, 72, 153, 0.1); color: var(--pink-600); padding: 2px 7px; border-radius: 999px; font-weight: 600; }

/* Note Editor */
.note-editor-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-flower {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--pink-50);
  color: var(--pink-400);
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.empty-state h3 { margin: 0 0 6px; color: var(--text); }
.empty-state p { margin: 0 0 18px; font-size: 14px; max-width: 340px; }

.note-editor { display: flex; flex-direction: column; flex: 1; height: 100%; }
.note-editor[data-color="blush"] { background: #fffafc; }
.note-editor[data-color="rose"] { background: #fff5f8; }
.note-editor[data-color="peach"] { background: #fffaf7; }
.note-editor[data-color="lavender"] { background: #fcfaff; }

.editor-toolbar {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.78);
}
.editor-toolbar-left, .editor-toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.color-picker { display: flex; gap: 6px; padding: 4px 8px; background: var(--surface-soft); border-radius: 999px; border: 1px solid var(--border); }
.color-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--border-strong);
  cursor: pointer;
}
.color-dot[data-color="white"] { background: #ffffff; }
.color-dot[data-color="blush"] { background: #ffe4ec; }
.color-dot[data-color="rose"] { background: #fbcfe8; }
.color-dot[data-color="peach"] { background: #ffe4d6; }
.color-dot[data-color="lavender"] { background: #ede9fe; }
.color-dot.active { box-shadow: 0 0 0 2px var(--pink-500); transform: scale(1.12); }

.mode-switch {
  display: inline-flex;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}
.mode-btn, .view-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 7px;
  cursor: pointer;
}
.mode-btn.active, .view-btn.active { background: var(--surface); color: var(--pink-600); box-shadow: var(--shadow-sm); }
.save-status { font-size: 12px; color: var(--text-muted); }

.note-title-input {
  border: none;
  border-radius: 0;
  background: transparent;
  font-size: 23px;
  font-weight: 700;
  padding: 20px 24px 8px;
  box-shadow: none !important;
}
.note-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 24px 12px;
  border-bottom: 1px dashed var(--border);
}
.note-tags-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 4px 0;
  font-size: 13px;
  color: var(--pink-600);
  box-shadow: none !important;
}
.note-updated { font-size: 12px; color: var(--text-light); white-space: nowrap; }
.note-textarea {
  flex: 1;
  min-height: 420px;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 18px 24px 28px;
  font-size: 15px;
  line-height: 1.75;
  resize: none;
  box-shadow: none !important;
}
.note-preview {
  flex: 1;
  min-height: 420px;
  padding: 18px 24px 28px;
  font-size: 15px;
  line-height: 1.75;
  overflow-y: auto;
}
.note-preview h1, .note-preview h2, .note-preview h3 { color: var(--pink-600); margin: 14px 0 8px; }
.note-preview code { background: var(--pink-50); color: var(--pink-600); padding: 2px 6px; border-radius: 6px; font-size: 13.5px; }
.note-preview pre { background: #fff0f5; border: 1px solid var(--border); padding: 12px 14px; border-radius: 10px; overflow-x: auto; }
.note-preview blockquote { margin: 10px 0; padding: 8px 14px; border-left: 3px solid var(--pink-400); background: var(--surface-soft); border-radius: 0 8px 8px 0; }
.note-preview a { color: var(--pink-600); }

/* Tasks Section */
.tasks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.tasks-filters, .tasks-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.quick-task-bar {
  display: grid;
  grid-template-columns: 1fr 165px 150px 150px auto;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}

.kanban-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.kanban-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  min-height: 360px;
}
.kanban-col[data-status="doing"] { background: #fffbfd; border-color: var(--pink-200); }
.kanban-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 14.5px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.kanban-cards { display: flex; flex-direction: column; gap: 10px; }

.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 14px;
  transition: all 0.16s ease;
  box-shadow: 0 2px 6px rgba(236, 72, 153, 0.04);
}
.task-card:hover { border-color: var(--pink-300); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.task-card.done { opacity: 0.72; background: #fffcfd; }
.task-card.done .task-title { text-decoration: line-through; color: var(--text-muted); }

.task-card-top { display: flex; align-items: flex-start; gap: 10px; }
.task-check {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border-radius: 6px;
  border: 2px solid var(--pink-300);
  background: #fff;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.task-check.checked { background: var(--pink-500); border-color: var(--pink-500); }
.task-title { font-weight: 600; font-size: 14px; line-height: 1.4; flex: 1; cursor: pointer; }
.task-desc { margin: 6px 0 0 30px; font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }
.task-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed var(--border);
  flex-wrap: wrap;
}
.task-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.prio-high { background: #ffe4e6; color: #be123c; }
.prio-medium { background: #fce7f3; color: #be185d; }
.prio-low { background: #f3f4f6; color: #6b7280; }
.cat-badge { background: var(--surface-soft); color: var(--text-muted); border: 1px solid var(--border); }
.due-badge { background: #fff7ed; color: #c2410c; }
.due-badge.overdue { background: #ffe4e6; color: #be123c; }

.task-controls { display: flex; align-items: center; gap: 4px; }
.tiny-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 7px;
  padding: 3px 7px;
  font-size: 11.5px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}
.tiny-btn:hover { background: var(--pink-50); color: var(--pink-600); border-color: var(--pink-300); }

.tasks-list-view {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(61, 36, 49, 0.28);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal-card {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-lg);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; gap: 10px; }
.modal-foot-right { display: flex; gap: 8px; margin-left: auto; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: #fff;
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 80;
}
.toast.pink { background: var(--pink-600); }

@media (max-width: 960px) {
  .notes-layout { grid-template-columns: 1fr; }
  .notes-sidebar { max-height: 320px; }
  .kanban-board { grid-template-columns: 1fr; }
  .quick-task-bar { grid-template-columns: 1fr 1fr; }
  .quick-task-bar input#quick-task-title { grid-column: 1 / -1; }
  .search-box input { width: 170px; }
}
@media (max-width: 600px) {
  .topbar { padding: 12px 14px; }
  .main-content { padding: 14px; }
  .grid-2 { grid-template-columns: 1fr; }
}
