*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --border: rgba(0,0,0,0.08);
  --text: #1a1a1a;
  --text-secondary: #666;
  --text-muted: #999;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
  --transition: 0.2s ease;
}

html { font-size: 15px; }
body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* Layout */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: var(--surface);
  border-right: 0.5px solid var(--border);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 0 20px 20px;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  border-bottom: 0.5px solid var(--border);
  margin-bottom: 8px;
}

.sidebar-nav { flex: 1; padding: 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.93rem;
  color: var(--text-secondary);
  transition: var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--bg); color: var(--text); font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.main {
  flex: 1;
  margin-left: 240px;
  padding: 24px 32px;
  max-width: 1200px;
}

.page { display: none; }
.page.active { display: block; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 0.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: var(--transition);
}
.filter-chip:hover { border-color: #ccc; }
.filter-chip.active { background: var(--text); color: #fff; border-color: var(--text); }

/* Cards */
.card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-lg); }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.stat-card .stat-value { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; }
.stat-card .stat-label { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }

/* Kanban */
.kanban {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  min-height: 400px;
}
.kanban-col {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 12px;
  border: 0.5px solid var(--border);
}
.kanban-col-header {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.kanban-col-header .count {
  background: var(--border);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
}

.task-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: var(--transition);
}
.task-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.task-card .task-title { font-size: 0.9rem; font-weight: 500; margin-bottom: 8px; }
.task-card .task-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.task-project-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.priority-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}
.priority-high { background: #fee2e2; color: #dc2626; }
.priority-med { background: #fef3c7; color: #d97706; }
.priority-low { background: #dbeafe; color: #2563eb; }

/* Notes grid */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.note-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
}
.note-card:hover { box-shadow: var(--shadow-lg); }
.note-card .note-title { font-weight: 600; margin-bottom: 8px; }
.note-card .note-preview {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.note-card .note-tags {
  margin-top: 10px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.tag {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  background: var(--bg);
  color: var(--text-muted);
}

/* Passwords */
.password-list { display: flex; flex-direction: column; gap: 8px; }
.password-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.password-item .pw-label { font-weight: 500; }
.password-item .pw-username { font-size: 0.85rem; color: var(--text-muted); }
.password-item .pw-actions { display: flex; gap: 8px; }

/* Resources */
.resource-group { margin-bottom: 24px; }
.resource-group h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.resource-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  transition: var(--transition);
}
.resource-item:hover { box-shadow: var(--shadow); }
.resource-item a { color: var(--text); text-decoration: none; font-weight: 500; font-size: 0.9rem; }
.resource-item .resource-type {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.87rem;
  font-weight: 500;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--text); color: #fff; border-color: var(--text); }
.btn-primary:hover { background: #333; }
.btn-danger { color: #dc2626; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-icon { padding: 6px; border-radius: var(--radius-sm); }

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  transform: translateY(20px);
  transition: transform 0.2s;
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal h2 { font-size: 1.15rem; margin-bottom: 20px; }

/* Form */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 9px 12px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--surface);
  transition: var(--transition);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none;
  border-color: #999;
}
.form-group textarea { min-height: 120px; resize: vertical; }

.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

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

/* Search */
.search-input {
  width: 100%;
  max-width: 360px;
  padding: 9px 14px 9px 36px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  background: var(--surface);
  transition: var(--transition);
}
.search-input:focus { outline: none; border-color: #999; }
.search-wrap { position: relative; }
.search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

/* Note detail modal */
.note-detail-content {
  font-size: 0.92rem;
  line-height: 1.7;
  white-space: pre-wrap;
}
.note-detail-content h1, .note-detail-content h2, .note-detail-content h3 { margin: 16px 0 8px; }
.note-detail-content code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.85em;
}

/* Recent tasks */
.recent-tasks { display: flex; flex-direction: column; gap: 6px; }
.recent-task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
}
.recent-task-item .task-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-todo { background: #e5e7eb; }
.status-inprog { background: #3b82f6; }
.status-done { background: #22c55e; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.3; }
.empty-state p { font-size: 0.9rem; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  background: var(--text);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  z-index: 2000;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); pointer-events: all; }

/* Mobile */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    top: auto;
    width: 100%;
    height: 60px;
    flex-direction: row;
    border-right: none;
    border-top: 0.5px solid var(--border);
    padding: 0;
    z-index: 100;
  }
  .sidebar-logo { display: none; }
  .sidebar-nav {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0;
    width: 100%;
  }
  .nav-item {
    flex-direction: column;
    gap: 2px;
    padding: 8px 4px;
    font-size: 0.68rem;
  }
  .nav-item svg { width: 20px; height: 20px; }
  .main { margin-left: 0; margin-bottom: 70px; padding: 16px; }
  .kanban { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; gap: 0; }
  .page-header { flex-wrap: wrap; gap: 10px; }
}
