/* ============================================================
   NotionLite — Premium Design System
   ============================================================ */

/* ── CSS Variables ── */
:root {
  --primary:        #6366f1;
  --primary-hover:  #4f46e5;
  --primary-light:  #e0e7ff;
  --accent:         #8b5cf6;
  --success:        #10b981;
  --warning:        #f59e0b;
  --danger:         #ef4444;
  --info:           #3b82f6;

  --bg-primary:     #ffffff;
  --bg-secondary:   #f8f9fa;
  --bg-tertiary:    #f1f3f5;
  --bg-hover:       #f0f0f0;
  --bg-active:      #e8e8ff;

  --text:           #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted:     #9090b0;
  --text-light:     #c0c0d8;

  --border:         #e5e7eb;
  --border-light:   #f0f0f5;
  --border-focus:   #6366f1;

  --shadow-sm:      0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:      0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:      0 10px 30px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
  --shadow-xl:      0 20px 50px rgba(0,0,0,0.15), 0 8px 16px rgba(0,0,0,0.08);

  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      16px;
  --radius-xl:      24px;
  --radius-full:    9999px;

  --sidebar-width:  260px;
  --topbar-height:  52px;
  --transition:     all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font:           'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
  --bg-primary:     #0f0f17;
  --bg-secondary:   #16161f;
  --bg-tertiary:    #1e1e2a;
  --bg-hover:       #22222f;
  --bg-active:      #2a2a42;

  --text:           #e8e8f5;
  --text-secondary: #a8a8c8;
  --text-muted:     #6060a0;
  --text-light:     #404060;

  --border:         #2a2a3a;
  --border-light:   #222230;
  --border-focus:   #6366f1;

  --shadow-sm:      0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:      0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg:      0 10px 30px rgba(0,0,0,0.5);
  --shadow-xl:      0 20px 50px rgba(0,0,0,0.6);
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ── App Layout ── */
#app-section {
  width: 100vw; height: 100vh;
  display: flex; flex-direction: row;
  overflow: hidden;
  position: fixed; top: 0; left: 0;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  overflow: hidden;
  position: relative;
  z-index: 100;
}

.sidebar.collapsed {
  width: 0;
  border-right: none;
}

.sidebar-header {
  padding: 14px 12px 10px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.workspace-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 8px;
}
.workspace-info:hover { background: var(--bg-hover); }

.workspace-avatar {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.workspace-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-actions {
  display: flex;
  gap: 6px;
}

.sidebar-action-btn {
  width: 100%;
  padding: 7px 10px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}
.sidebar-action-btn:hover { background: var(--bg-hover); color: var(--text); }

.new-page-btn {
  background: linear-gradient(135deg, var(--primary), var(--accent)) !important;
  color: #fff !important;
  font-weight: 500;
  justify-content: center;
  border-radius: var(--radius-md) !important;
  padding: 8px 12px !important;
  margin-top: 4px;
}
.new-page-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99,102,241,0.3) !important;
}

/* ── Sidebar Nav ── */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-family: var(--font);
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active {
  background: var(--bg-active);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-group-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 12px 10px 4px;
}

.sidebar-page-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
  color: var(--text-secondary);
  position: relative;
}
.sidebar-page-item:hover { background: var(--bg-hover); color: var(--text); }
.sidebar-page-item.active { background: var(--bg-active); color: var(--primary); font-weight: 500; }

.sidebar-page-icon { font-size: 14px; flex-shrink: 0; }
.sidebar-page-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-page-actions {
  display: none;
  gap: 2px;
  align-items: center;
}
.sidebar-page-item:hover .sidebar-page-actions { display: flex; }
.sidebar-page-actions button {
  width: 22px; height: 22px;
  background: none; border: none;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.sidebar-page-actions button:hover { background: var(--bg-tertiary); color: var(--text); }

/* ── Sidebar Footer ── */
.sidebar-footer {
  padding: 10px 8px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}
.user-profile:hover { background: var(--bg-hover); }

.user-avatar {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.user-info { flex: 1; overflow: hidden; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-email { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#user-menu {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px;
  margin-top: 4px;
  box-shadow: var(--shadow-md);
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  min-width: 0;
  overflow: hidden;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
  flex-shrink: 0;
  position: relative;
  z-index: 50;
}

.topbar-toggle {
  width: 32px; height: 32px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.topbar-toggle:hover { background: var(--bg-hover); color: var(--text); }

.topbar-breadcrumb {
  flex: 1;
  font-size: 14px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.search-input {
  width: 220px;
  padding: 7px 14px 7px 36px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  transition: var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239090b0' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}
.search-input:focus {
  outline: none;
  border-color: var(--border-focus);
  background-color: var(--bg-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
  width: 280px;
}
.search-input::placeholder { color: var(--text-muted); }

/* ── Content Area ── */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 40px 48px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* ── Dashboard ── */
.dashboard-greeting {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: var(--transition);
  cursor: default;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -1px;
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.dashboard-section { margin-bottom: 32px; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.btn-text {
  background: none; border: none;
  color: var(--primary);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.btn-text:hover { background: var(--primary-light); }

.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.recent-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.recent-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--primary);
}

.recent-card-new {
  border: 2px dashed var(--border);
  background: transparent;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.recent-card-new:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.recent-card-icon { font-size: 28px; }
.recent-card-title { font-size: 14px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-card-meta { font-size: 12px; color: var(--text-muted); }

/* ── Task Simple List (Dashboard) ── */
.task-list-simple { display: flex; flex-direction: column; gap: 8px; }
.task-item-simple {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
}
.task-item-simple:hover { box-shadow: var(--shadow-sm); }

.task-checkbox {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  transition: var(--transition);
}
.task-checkbox:hover { border-color: var(--primary); }
.task-checkbox.checked {
  background: var(--primary);
  border-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.task-info { flex: 1; }
.task-title { font-size: 14px; color: var(--text); font-weight: 500; }
.task-title.done { text-decoration: line-through; color: var(--text-muted); }
.task-meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; flex-wrap: wrap; }

.priority-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.priority-high   { background: #fee2e2; color: #dc2626; }
.priority-medium { background: #fef9c3; color: #ca8a04; }
.priority-low    { background: #dcfce7; color: #16a34a; }

/* ── Editor ── */
.editor-container { max-width: 760px; margin: 0 auto; }

.editor-header { margin-bottom: 16px; }

.editor-icon-picker {
  font-size: 52px;
  cursor: pointer;
  display: inline-block;
  margin-bottom: 12px;
  transition: var(--transition);
  line-height: 1;
}
.editor-icon-picker:hover { transform: scale(1.1); }

.editor-title {
  width: 100%;
  font-size: 36px;
  font-weight: 700;
  color: var(--text);
  background: none;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font);
  line-height: 1.25;
  letter-spacing: -0.5px;
  overflow: hidden;
  padding: 0;
}
.editor-title::placeholder { color: var(--text-light); }

.editor-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.editor-meta-item { font-size: 12px; color: var(--text-muted); }

.save-status { font-size: 12px; }
.save-status.saving { color: var(--warning); }
.save-status.saved  { color: var(--success); }
.save-status.error  { color: var(--danger); }

.word-count { font-size: 12px; color: var(--text-muted); }

/* ── Editor Ribbon Toolbar (Office Style) ── */
.editor-toolbar {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  padding: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  overflow-x: auto;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.ribbon-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 8px;
  border-right: 1px solid var(--border);
  position: relative;
}
.ribbon-group:last-child { border-right: none; }

.ribbon-row {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.ribbon-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
  font-weight: 600;
}

.ribbon-btn-big {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text);
  transition: var(--transition);
  min-width: 60px;
}
.ribbon-btn-big:hover { background: var(--bg-hover); border-color: var(--border); }
.ribbon-btn-big svg { margin-bottom: 4px; color: var(--primary); }
.ribbon-btn-big span { font-size: 12px; font-weight: 500; }

.ribbon-btn-sm {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
  font-size: 13px;
}
.ribbon-btn-sm:hover { background: var(--bg-hover); border-color: var(--border); color: var(--text); }
.ribbon-btn-sm.active { background: var(--bg-active); color: var(--primary); border-color: var(--primary-light); }

.ribbon-select {
  height: 24px;
  padding: 0 4px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text);
  font-family: var(--font);
  outline: none;
}
.ribbon-select:focus { border-color: var(--primary); }

.ribbon-divider-v {
  width: 1px;
  height: 24px;
  background: var(--border-light);
  margin: 0 4px;
}

/* Specific button styles */
.btn-bold { font-weight: 800; font-size: 15px; }
.btn-italic { font-style: italic; font-family: serif; font-size: 15px; }
.btn-underline { text-decoration: underline; font-size: 15px; }
.btn-strike { text-decoration: line-through; font-size: 13px; }
.btn-sub { font-size: 10px; transform: translateY(3px); }
.btn-sup { font-size: 10px; transform: translateY(-3px); }
.btn-color { position: relative; }
.btn-color::after {
  content: '';
  position: absolute;
  bottom: 4px; left: 4px; right: 4px;
  height: 3px;
  background: currentColor;
  border-radius: 1px;
}

/* ── Editor Content ── */
.editor-content {
  min-height: 400px;
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
  outline: none;
  caret-color: var(--primary);
}
.editor-content:empty::before {
  content: "Start writing, or press '/' for commands...";
  color: var(--text-light);
  pointer-events: none;
}
.editor-content h1 { font-size: 2em; font-weight: 700; margin: 1em 0 0.5em; letter-spacing: -0.5px; }
.editor-content h2 { font-size: 1.5em; font-weight: 600; margin: 0.9em 0 0.4em; }
.editor-content h3 { font-size: 1.2em; font-weight: 600; margin: 0.8em 0 0.3em; }
.editor-content p  { margin: 0.5em 0; }
.editor-content ul, .editor-content ol { padding-left: 1.5em; margin: 0.5em 0; }
.editor-content li { margin: 0.25em 0; }
.editor-content blockquote {
  border-left: 3px solid var(--primary);
  padding: 8px 16px;
  margin: 12px 0;
  background: var(--primary-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  font-style: italic;
}
.editor-content pre {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 13px;
  overflow-x: auto;
  margin: 12px 0;
}
.editor-content a { color: var(--primary); text-decoration: underline; }
.editor-content hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── Pages List ── */
.pages-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.pages-title { font-size: 24px; font-weight: 700; color: var(--text); }

.pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.page-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.page-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: 0;
  transition: var(--transition);
}
.page-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--primary);
}
.page-card:hover::before { opacity: 1; }

.page-card-icon { font-size: 32px; margin-bottom: 10px; }
.page-card-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-card-meta { font-size: 12px; color: var(--text-muted); }
.page-card-actions {
  display: none;
  position: absolute;
  top: 10px; right: 10px;
  gap: 4px;
}
.page-card:hover .page-card-actions { display: flex; }
.page-card-actions button {
  width: 26px; height: 26px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  color: var(--text-muted);
}
.page-card-actions button:hover { background: var(--bg-hover); color: var(--text); }

/* ── Tasks View ── */
.tasks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.tasks-title { font-size: 24px; font-weight: 700; color: var(--text); }

.tasks-filter {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-btn {
  padding: 6px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 500;
}

.task-list { display: flex; flex-direction: column; gap: 8px; }

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition);
}
.task-item:hover { box-shadow: var(--shadow-sm); }
.task-item.completed { opacity: 0.6; }

.task-item-info { flex: 1; }
.task-item-title { font-size: 14px; font-weight: 500; color: var(--text); }
.task-item-title.done { text-decoration: line-through; color: var(--text-muted); }
.task-item-desc { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.task-item-meta { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }

.task-item-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  opacity: 0;
  transition: var(--transition);
}
.task-item:hover .task-item-actions { opacity: 1; }
.task-item-actions button {
  width: 28px; height: 28px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.task-item-actions button:hover { background: var(--bg-hover); color: var(--text); }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
}

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  transition: var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  background: var(--bg-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-select option { background: var(--bg-primary); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  transition: var(--transition);
  text-decoration: none;
}
.btn:hover { background: var(--bg-hover); }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-danger:hover { opacity: 0.9; }

.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn-full { width: 100%; }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ── AI Panel ── */
.ai-panel {
  position: fixed;
  right: 0; top: 0;
  width: 340px; height: 100vh;
  background: var(--bg-primary);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.ai-panel.open { transform: translateX(0); }

.ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ai-panel-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-panel-header h3::before {
  content: '✨';
  font-size: 16px;
}
.ai-panel-header button {
  width: 28px; height: 28px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.ai-panel-header button:hover { background: var(--bg-hover); color: var(--text); }

.ai-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ai-actions button {
  padding: 9px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-actions button:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.ai-result {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.ai-result-text {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
  white-space: pre-wrap;
  font-size: 13px;
}

.ai-result-actions { display: flex; gap: 8px; }

.ai-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.ai-input-area input {
  width: 100%;
  padding: 9px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  transition: var(--transition);
}
.ai-input-area input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

/* ── Icon Picker ── */
.icon-picker-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.icon-picker-grid {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  max-width: 380px;
  box-shadow: var(--shadow-xl);
}
.icon-picker-grid span {
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  text-align: center;
  transition: var(--transition);
}
.icon-picker-grid span:hover { background: var(--bg-hover); transform: scale(1.2); }

/* ── Database ── */
.database-container {}
.db-view-tabs { display: flex; gap: 4px; margin-top: 16px; border-bottom: 1px solid var(--border); }
.db-view-tab {
  padding: 8px 14px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: -1px;
}
.db-view-tab:hover { color: var(--text); }
.db-view-tab.active { border-bottom-color: var(--primary); color: var(--primary); font-weight: 600; }

.db-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.db-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}
.db-table td { padding: 0; border-bottom: 1px solid var(--border-light); }
.db-table tr:hover td { background: var(--bg-secondary); }
.db-table input {
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
}
.db-table input:focus {
  outline: none;
  background: var(--bg-primary);
  box-shadow: inset 0 0 0 2px var(--primary);
}

.db-board { display: flex; gap: 16px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; }
.db-board-column {
  flex: 0 0 240px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.db-board-column-header {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.db-board-item {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: var(--transition);
}
.db-board-item:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }

/* ── Empty States ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state-title { font-size: 18px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state-desc { font-size: 14px; margin-bottom: 20px; }

/* ── Notifications ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: var(--bg-primary);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .sidebar {
    position: absolute;
    left: 0; top: 0;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-xl);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.collapsed { transform: translateX(-100%); }

  .content-area { padding: 20px 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .recent-grid { grid-template-columns: 1fr 1fr; }
  .search-input { width: 160px; }
  .search-input:focus { width: 200px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .recent-grid { grid-template-columns: 1fr; }
  .ai-panel { width: 100vw; }
}
