/* ===== CSS Variables ===== */
:root {
  --dock-width: 64px;
  --dock-bg: rgba(30, 30, 40, 0.85);
  --glass-bg: rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-bg-light: rgba(255, 255, 255, 0.92);
  --text-primary: #fff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  color: var(--text-primary);
  user-select: none;
}

input, textarea, select, [contenteditable="true"] {
  user-select: text;
  -webkit-user-select: text;
}

/* ===== Background ===== */
#bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
}

#bg-image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(var(--bg-blur, 5px));
  transform: scale(1.05);
  transition: background-image 0.5s ease;
}

#bg-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, var(--bg-overlay, 0.3));
}

/* ===== Dock Sidebar ===== */
#dock {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--dock-width);
  background: var(--dock-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  z-index: 100;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

#dock-top, #dock-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.dock-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  position: relative;
}

.dock-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.dock-btn span {
  font-size: 9px;
  margin-top: 2px;
  opacity: 0.8;
}

.dock-emoji {
  font-size: 18px;
  line-height: 1;
}

.dock-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.dock-btn.active {
  background: rgba(59, 130, 246, 0.3);
  color: #60a5fa;
}

.dock-btn.active::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

/* ===== Main Content ===== */
#content {
  position: relative;
  z-index: 10;
  margin-left: var(--dock-width);
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 40px 300px 40px 40px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

#content::-webkit-scrollbar {
  width: 6px;
}

#content::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
}

/* ===== Project Widget Sidebar ===== */
#home-right {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  height: 100vh;
  padding: 20px 16px;
  overflow-y: auto;
  z-index: 10;
  scrollbar-width: none;
}

#home-right::-webkit-scrollbar {
  display: none;
}

/* ===== Weather Widget ===== */
#weather-widget {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 16px;
  color: #fff;
  margin-bottom: 12px;
}

#weather-loading {
  text-align: center;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  padding: 8px 0;
}

#weather-main {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

#weather-icon {
  font-size: 28px;
}

#weather-temp {
  font-size: 24px;
  font-weight: 700;
}

#weather-desc {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
}

#weather-city-row {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 10px;
}

#weather-forecast {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.weather-day {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255,255,255,0.7);
}

.weather-day-name {
  width: 36px;
  font-weight: 500;
  color: rgba(255,255,255,0.5);
}

.weather-day-icon {
  font-size: 14px;
  width: 24px;
  text-align: center;
}

.weather-day-temp {
  font-size: 12px;
  color: #fff;
  font-weight: 500;
}

/* ===== Clock ===== */
#clock-area {
  text-align: center;
  padding: 20px 0 30px;
}

#clock-time {
  font-size: 72px;
  font-weight: 200;
  letter-spacing: 4px;
  text-shadow: 0 2px 20px rgba(0,0,0,0.3);
  line-height: 1;
}

#clock-date {
  font-size: 16px;
  color: var(--text-secondary);
  margin-top: 8px;
  letter-spacing: 2px;
  text-shadow: 0 1px 10px rgba(0,0,0,0.3);
}

/* ===== Search Bar ===== */
#search-bar {
  max-width: 560px;
  margin: 0 auto 40px;
  display: flex;
  align-items: center;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 50px;
  padding: 6px 8px 6px 16px;
  transition: var(--transition);
}

#search-bar:focus-within {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

#search-engine-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}

#search-engine-icon:hover {
  background: rgba(255,255,255,0.15);
}

#search-engine-icon svg {
  width: 20px;
  height: 20px;
}

#search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 15px;
  padding: 8px 12px;
}

#search-input::placeholder {
  color: var(--text-secondary);
}

#search-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255,255,255,0.1);
  color: var(--text-secondary);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

#search-btn:hover {
  background: var(--accent);
  color: #fff;
}

#search-btn svg {
  width: 18px;
  height: 18px;
}

/* ===== Bookmarks Area ===== */
#bookmarks-area {
  max-width: 1200px;
  margin: 0 auto;
}

.bookmark-category {
  margin-bottom: 32px;
}

.category-title {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  padding-left: 4px;
  letter-spacing: 1px;
}

.bookmark-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 16px;
}

.bookmark-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-primary);
  padding: 8px;
  border-radius: var(--radius);
  transition: var(--transition);
}

.bookmark-item:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.bookmark-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: var(--transition);
  position: relative;
}

.bookmark-icon.rounded {
  border-radius: 16px;
}

.bookmark-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bookmark-icon .icon-letter {
  font-size: 22px;
  font-weight: 600;
  color: #fff;
}

.bookmark-item:hover .bookmark-icon {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.bookmark-name {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Settings Panel ===== */
#settings-overlay,
#bookmark-modal-overlay,
#category-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 500;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#settings-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 680px;
  max-width: 90vw;
  height: 520px;
  max-height: 85vh;
  background: var(--glass-bg-light);
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 510;
  display: flex;
  overflow: hidden;
}

#settings-sidebar {
  width: 200px;
  background: #f8f9fa;
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-right: 1px solid #e5e7eb;
}

#settings-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 20px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 8px;
}

#settings-user .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
}

#settings-user span {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.settings-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  text-align: left;
}

.settings-nav svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.settings-nav:hover {
  background: #e5e7eb;
  color: #374151;
}

.settings-nav.active {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  font-weight: 500;
}

#settings-content {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
  color: #374151;
}

#settings-content h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 20px;
  color: #111827;
}

#settings-content h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #374151;
}

.settings-tab {
  display: none;
}

.settings-tab.active {
  display: block;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 14px;
}

.setting-item span:first-child {
  color: #4b5563;
}

/* Toggle Switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #d1d5db;
  border-radius: 24px;
  transition: var(--transition);
}

.toggle .slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
}

.toggle input:checked + .slider {
  background: var(--accent);
}

.toggle input:checked + .slider::before {
  transform: translateX(20px);
}

/* Range slider */
input[type="range"] {
  -webkit-appearance: none;
  width: 120px;
  height: 4px;
  background: #d1d5db;
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}

.range-val {
  font-size: 12px;
  color: #9ca3af;
  min-width: 36px;
  text-align: right;
}

/* Select */
select {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

select:focus {
  border-color: var(--accent);
}

/* Buttons */
.btn-primary {
  padding: 8px 20px;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition);
}

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

.btn-secondary {
  padding: 8px 20px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: #f3f4f6;
}

.btn-danger {
  padding: 8px 20px;
  border: none;
  background: var(--danger);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition);
}

.btn-danger:hover {
  background: #dc2626;
}

.setting-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Wallpaper preview */
#wallpaper-preview {
  width: 100%;
  max-width: 300px;
  aspect-ratio: 16/10;
  border-radius: var(--radius);
  overflow: hidden;
  background: #1f2937;
  margin: 0 auto;
}

#wallpaper-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#wallpaper-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.wallpaper-thumb {
  aspect-ratio: 16/10;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}

.wallpaper-thumb:hover {
  border-color: var(--accent);
  transform: scale(1.03);
}

.wallpaper-thumb.active {
  border-color: var(--accent);
}

.wallpaper-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* DateTime preview */
#datetime-preview {
  background: #1e1e2e;
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  margin-bottom: 24px;
}

#dt-preview-time {
  font-size: 48px;
  font-weight: 200;
  color: #fff;
  letter-spacing: 2px;
}

#dt-preview-date {
  font-size: 14px;
  color: rgba(255,255,255,0.6);
  margin-top: 6px;
}

/* About */
.about-content {
  text-align: center;
  padding: 40px 20px;
}

.about-logo {
  font-size: 64px;
  margin-bottom: 16px;
}

.about-content h2 {
  font-size: 24px;
  color: #111827;
  margin-bottom: 8px;
}

.about-content p {
  color: #6b7280;
  font-size: 14px;
}

/* ===== Modals ===== */
#bookmark-modal,
#category-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 440px;
  max-width: 90vw;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 510;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid #f3f4f6;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}

.modal-header button {
  background: none;
  border: none;
  font-size: 24px;
  color: #9ca3af;
  cursor: pointer;
  line-height: 1;
}

.modal-header button:hover {
  color: #374151;
}

.modal-body {
  padding: 20px 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #4b5563;
  margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  color: #374151;
  outline: none;
  transition: var(--transition);
  background: #fff;
  user-select: text;
  -webkit-user-select: text;
}

.form-group input[type="password"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  color: #374151;
  outline: none;
  transition: var(--transition);
  background: #fff;
  user-select: text;
  -webkit-user-select: text;
}

.form-group input[type="password"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.bm-pwd-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.bm-pwd-row input {
  flex: 1;
}

.bm-pwd-toggle {
  width: 38px;
  height: 38px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #f9fafb;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.bm-pwd-toggle:hover {
  background: #e5e7eb;
}

/* Credential badge on bookmarks */
.bookmark-item {
  position: relative;
}

.bm-cred-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s;
  cursor: pointer;
  z-index: 2;
}

.bookmark-item:hover .bm-cred-badge {
  opacity: 1;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Icon Picker Grid */
.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  padding: 10px;
  background: #f9fafb;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  max-height: 180px;
  overflow-y: auto;
}

.icon-pick-item {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s;
  background: #fff;
}

.icon-pick-item:hover {
  background: #e5e7eb;
  transform: scale(1.1);
}

.icon-pick-item.selected {
  border-color: var(--accent);
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}

.form-group input[type="color"] {
  width: 50px;
  height: 36px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  padding: 2px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid #f3f4f6;
}

/* ===== Todo Panel ===== */
#todo-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 520px;
  max-width: 90vw;
  height: 480px;
  max-height: 80vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 510;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid #f3f4f6;
}

.panel-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}

.panel-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #9ca3af;
  cursor: pointer;
}

.panel-close:hover {
  color: #374151;
}

#todo-filters {
  display: flex;
  gap: 0;
  padding: 0 24px;
  border-bottom: 1px solid #f3f4f6;
}

.todo-filter {
  padding: 12px 16px;
  border: none;
  background: none;
  color: #6b7280;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}

.todo-filter:hover {
  color: #374151;
}

.todo-filter.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 500;
}

.todo-filter span {
  margin-left: 4px;
  font-size: 11px;
  background: #e5e7eb;
  padding: 1px 6px;
  border-radius: 10px;
}

#todo-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 24px;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f9fafb;
}

.todo-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.todo-item .todo-text {
  flex: 1;
  font-size: 14px;
  color: #374151;
}

.todo-item.done .todo-text {
  text-decoration: line-through;
  color: #9ca3af;
}

.todo-item .todo-delete {
  background: none;
  border: none;
  color: #d1d5db;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
}

.todo-item .todo-delete:hover {
  color: var(--danger);
  background: #fef2f2;
}

.todo-empty {
  text-align: center;
  padding: 60px 20px;
  color: #9ca3af;
}

.todo-empty svg {
  width: 80px;
  height: 80px;
  color: #e5e7eb;
  margin-bottom: 12px;
}

#todo-input-area {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  border-top: 1px solid #f3f4f6;
  gap: 8px;
}

#todo-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  color: #374151;
}

#todo-input:focus {
  border-color: var(--accent);
}

#todo-add {
  width: 38px;
  height: 38px;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

#todo-add:hover {
  background: var(--accent-hover);
}

/* ===== Context Menu ===== */
#context-menu {
  position: fixed;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
  padding: 6px;
  z-index: 600;
  min-width: 140px;
}

#context-menu button {
  display: block;
  width: 100%;
  padding: 8px 14px;
  border: none;
  background: none;
  color: #374151;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  transition: var(--transition);
}

#context-menu button:hover {
  background: #f3f4f6;
}

#ctx-delete:hover {
  background: #fef2f2;
  color: var(--danger);
}

/* ===== Category List (Settings) ===== */
.category-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #f9fafb;
  border-radius: 8px;
  margin-bottom: 8px;
}

.category-item-row .cat-icon-preview {
  font-size: 18px;
  width: 28px;
  text-align: center;
}

.category-item-row .cat-name-label {
  flex: 1;
  font-size: 14px;
  color: #374151;
}

.category-item-row .cat-count {
  font-size: 12px;
  color: #9ca3af;
}

.category-item-row button {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 14px;
}

.category-item-row button:hover {
  color: var(--accent);
  background: #e0e7ff;
}

/* ===== Utility ===== */
.hidden {
  display: none !important;
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.bookmark-category {
  animation: fadeIn 0.4s ease forwards;
}

/* ===== Notes Panel ===== */
#notes-overlay,
#flow-overlay,
#flow-node-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 500;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#notes-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 860px;
  max-width: 92vw;
  height: 580px;
  max-height: 88vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 510;
  overflow: hidden;
}

#notes-layout {
  display: flex;
  height: 100%;
}

#notes-sidebar {
  width: 260px;
  background: #f8f9fa;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

#notes-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px;
}

#notes-sidebar-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}

#notes-add-btns {
  display: flex;
  gap: 4px;
}

.btn-sm {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-sm:hover {
  background: #e5e7eb;
}

#notes-search-box {
  padding: 4px 12px 8px;
}

#notes-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  background: #fff;
  color: #374151;
}

#notes-search:focus {
  border-color: var(--accent);
}

#notes-tab-bar {
  display: flex;
  padding: 0 12px;
  border-bottom: 1px solid #e5e7eb;
}

.notes-tab {
  flex: 1;
  padding: 8px 0;
  border: none;
  background: none;
  font-size: 12px;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}

.notes-tab:hover {
  color: #374151;
}

.notes-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

#notes-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.note-list-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 0.15s ease, transform 0.1s ease;
  color: #374151;
  background: transparent;
}

.note-list-item:hover {
  background: #eef0f3;
}

.note-list-item:active {
  transform: scale(0.98);
  background: #dde1e7;
}

.note-list-item.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.note-list-item.active:hover {
  background: var(--accent-hover);
}

.note-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.note-item-del {
  display: none;
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s;
  flex-shrink: 0;
}

.note-list-item:hover .note-item-del {
  display: block;
}

.note-item-del:hover {
  color: #ef4444;
}

.note-list-item.active .note-item-del {
  color: rgba(255,255,255,0.6);
}

.note-list-item.active .note-item-del:hover {
  color: #fff;
}

.note-list-item .note-item-icon {
  font-size: 14px;
  margin-right: 6px;
}

.note-color-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}

.note-list-item .note-item-title {
  font-size: 13px;
  font-weight: 500;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #1f2937;
}

.note-list-item.active .note-item-title {
  color: #fff;
}

.note-list-item .note-item-sub {
  font-size: 11px;
  color: #6b7280;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-left: 0;
}

.note-list-item.active .note-item-sub {
  color: rgba(255,255,255,0.8);
}

/* Notes Editor */
#notes-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#notes-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 14px;
}

#note-edit-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* macOS dots */
.macos-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.dot-green {
  background: #34c759;
}

.dot-red {
  background: #ff3b30;
}

.dot-green::after {
  content: '🗑';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  opacity: 0;
  transition: opacity 0.15s;
}

.dot-red::after {
  content: '✕';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #7a0000;
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.15s;
}

.dot:hover::after {
  opacity: 1;
}

.dot-green:hover {
  background: #28a745;
}

.dot-red:hover {
  background: #e0342b;
}

#note-edit-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid #f3f4f6;
}

#note-edit-title {
  flex: 1;
  border: none;
  outline: none;
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  background: transparent;
}

.note-type-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#note-type-password:not(.hidden) {
  display: block;
  padding: 20px;
}

/* Rich Text Toolbar */
#note-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 16px;
  border-bottom: 1px solid #f3f4f6;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.tb-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #4b5563;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  position: relative;
}

.tb-btn:hover {
  background: #e5e7eb;
  color: #111827;
}

.tb-btn b {
  font-size: 14px;
}

.tb-btn u {
  font-size: 14px;
}

.tb-btn i {
  font-size: 14px;
  font-style: italic;
}

.tb-sep {
  width: 1px;
  height: 20px;
  background: #e5e7eb;
  margin: 0 4px;
}

.tb-select {
  padding: 4px 6px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 12px;
  color: #4b5563;
  background: #fff;
  cursor: pointer;
  outline: none;
}

/* Alignment icons */
.align-icon {
  width: 16px;
  height: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.align-icon::before,
.align-icon::after {
  content: '';
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

.align-icon::before {
  box-shadow: 0 5px 0 currentColor;
}

.align-left::before { width: 100%; }
.align-left::after { width: 65%; }

.align-center::before { width: 100%; margin: 0 auto; }
.align-center::after { width: 65%; margin: 0 auto; }

.align-right::before { width: 100%; margin-left: auto; }
.align-right::after { width: 65%; margin-left: auto; }

.align-justify::before { width: 100%; }
.align-justify::after { width: 100%; }

/* List icons */
.list-icon {
  width: 16px;
  height: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.list-icon::before,
.list-icon::after {
  content: '';
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

.list-icon::before {
  box-shadow: 0 5px 0 currentColor;
}

.list-ul::before {
  width: 70%;
  margin-left: 6px;
  box-shadow: 0 5px 0 currentColor, -6px 0 0 0 currentColor, -6px 5px 0 0 currentColor;
}
.list-ul::after {
  width: 70%;
  margin-left: 6px;
  box-shadow: -6px 0 0 0 currentColor;
}

.list-ol::before {
  width: 70%;
  margin-left: 6px;
}
.list-ol::after {
  width: 70%;
  margin-left: 6px;
}

/* Dropdown menu items */
.cp-menu-item {
  padding: 8px 12px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
  white-space: nowrap;
}

.cp-menu-item:hover {
  background: #f3f4f6;
}

.cp-menu-item .align-icon {
  display: inline-flex;
  vertical-align: middle;
  margin-right: 8px;
}

.cp-menu-item s {
  margin-right: 4px;
}

.tb-color-bar {
  position: absolute;
  bottom: 3px;
  left: 6px;
  right: 6px;
  height: 3px;
  border-radius: 2px;
  background: #000;
}

.tb-color-wrap {
  position: relative;
}

.color-picker {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  padding: 10px;
  z-index: 100;
  width: 232px;
}

.cp-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px 10px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  margin-bottom: 8px;
  border-radius: 6px;
  transition: background 0.15s;
}

.cp-header:hover {
  background: #f3f4f6;
}

.cp-header span {
  font-size: 16px;
}

.cp-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 3px;
}

.cp-cell {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.1s, border-color 0.1s;
}

.cp-cell:hover {
  transform: scale(1.2);
  border-color: rgba(0,0,0,0.25);
  z-index: 1;
}

/* Contenteditable editor */
#note-edit-content {
  flex: 1;
  padding: 16px 20px;
  outline: none;
  font-size: 14px;
  line-height: 1.8;
  color: #374151;
  overflow-y: auto;
  min-height: 200px;
}

#note-edit-content:empty::before {
  content: attr(data-placeholder);
  color: #c0c4cc;
  pointer-events: none;
}

#note-edit-content blockquote {
  border-left: 4px solid var(--accent);
  margin: 8px 0;
  padding: 8px 16px;
  background: #f0f5ff;
  color: #374151;
  border-radius: 0 8px 8px 0;
}

#note-edit-content pre {
  background: #1e1e2e;
  color: #a6e3a1;
  padding: 12px 16px;
  border-radius: 8px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  overflow-x: auto;
  margin: 8px 0;
}

#note-edit-content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 8px 0;
}

#note-edit-content a {
  color: var(--accent);
  text-decoration: underline;
}

#note-edit-content ul, #note-edit-content ol {
  padding-left: 24px;
  margin: 4px 0;
}

#note-edit-content hr {
  border: none;
  border-top: 2px solid #e5e7eb;
  margin: 12px 0;
}

#note-edit-content code {
  background: #f1f5f9;
  color: #e11d48;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.9em;
}

/* Password Fields */
.pwd-field-group {
  margin-bottom: 16px;
}

.pwd-field-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pwd-field-group input[type="text"],
.pwd-field-group input[type="password"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  color: #374151;
  outline: none;
  transition: var(--transition);
  background: #f9fafb;
}

.pwd-field-group input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.pwd-field-group textarea {
  width: 100%;
  height: 60px;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  color: #374151;
  outline: none;
  resize: vertical;
  font-family: inherit;
  background: #f9fafb;
}

.pwd-field-group textarea:focus {
  border-color: var(--accent);
  background: #fff;
}

.pwd-input-row {
  display: flex;
  gap: 6px;
}

.pwd-input-row input {
  flex: 1;
}

.pwd-copy-btn,
.pwd-toggle-btn {
  width: 38px;
  height: 38px;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.pwd-copy-btn:hover,
.pwd-toggle-btn:hover {
  background: #f3f4f6;
  border-color: var(--accent);
}

.pwd-copy-btn.copied {
  background: #d1fae5;
  border-color: #10b981;
}

#note-edit-footer {
  padding: 10px 20px;
  border-top: 1px solid #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

#note-color-tags {
  display: flex;
  gap: 6px;
  align-items: center;
}

.color-tag {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: transparent;
}

.color-tag[data-color=""] {
  background: #e5e7eb;
  color: #9ca3af;
}

.color-tag:hover {
  transform: scale(1.15);
  border-color: rgba(0,0,0,0.15);
}

.color-tag.selected {
  border-color: #374151;
  transform: scale(1.15);
}

.color-tag.selected[data-color=""] {
  color: #6b7280;
}

#note-footer-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 11px;
  color: #9ca3af;
}

/* ===== FlowMap Panel ===== */
#flow-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 92vw;
  max-width: 1100px;
  height: 80vh;
  max-height: 700px;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 510;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#flow-node-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 440px;
  max-width: 90vw;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 520;
  overflow: hidden;
}

#flow-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
}

#flow-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  margin-right: 12px;
}

#flow-header-left,
#flow-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

#flow-project-select {
  padding: 6px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  color: #374151;
  background: #fff;
  outline: none;
  cursor: pointer;
  max-width: 200px;
}

#flow-canvas-wrapper {
  flex: 1;
  overflow: auto;
  background: #fafbfc;
  background-image: radial-gradient(circle, #e5e7eb 1px, transparent 1px);
  background-size: 20px 20px;
  position: relative;
}

#flow-canvas {
  padding: 40px;
  min-width: 100%;
  min-height: 100%;
  transform-origin: top left;
  transition: transform 0.2s ease;
}

#flow-hint {
  padding: 8px 20px;
  font-size: 12px;
  color: #9ca3af;
  border-top: 1px solid #f3f4f6;
  text-align: center;
  flex-shrink: 0;
}

/* Flow Tree Nodes */
.flow-tree {
  display: flex;
  align-items: flex-start;
}

.flow-node-wrap {
  display: flex;
  align-items: center;
}

.flow-node {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  min-width: 120px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  user-select: none;
  white-space: nowrap;
}

.flow-node:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(59,130,246,0.15);
  transform: translateY(-1px);
}

.flow-node .fn-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.flow-node .fn-status.pending {
  background: #d1d5db;
}

.flow-node .fn-status.active {
  background: var(--accent);
  box-shadow: 0 0 6px rgba(59,130,246,0.5);
  animation: pulse 2s infinite;
}

.flow-node .fn-status.done {
  background: #10b981;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.flow-node .fn-label {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
}

.flow-node .fn-desc-badge {
  font-size: 10px;
  color: #9ca3af;
  margin-left: -4px;
}

.flow-node-add {
  width: 28px;
  height: 28px;
  border: 2px dashed #d1d5db;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #9ca3af;
  transition: var(--transition);
  flex-shrink: 0;
  margin-left: 8px;
}

.flow-node-add:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #eff6ff;
}

.flow-children {
  display: flex;
  flex-direction: column;
  margin-left: 16px;
  position: relative;
  gap: 12px;
}

.flow-children::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #e5e7eb;
}

.flow-child-row {
  display: flex;
  align-items: center;
  position: relative;
}

.flow-child-row::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 50%;
  width: 16px;
  height: 2px;
  background: #e5e7eb;
}

.flow-children .flow-child-row:first-child::after {
  content: '';
  position: absolute;
  left: -16px;
  top: 0;
  height: 50%;
  width: 2px;
  background: #fafbfc;
}

.flow-children .flow-child-row:last-child::after {
  content: '';
  position: absolute;
  left: -16px;
  top: 50%;
  bottom: 0;
  width: 2px;
  background: #fafbfc;
}

/* Flow root-level add button */
.flow-add-root {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: #9ca3af;
  transition: var(--transition);
  margin-top: 16px;
}

.flow-add-root:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #eff6ff;
}

.flow-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: #9ca3af;
}

.flow-empty .flow-empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  :root {
    --dock-width: 50px;
  }

  #content {
    padding: 20px 20px 20px 16px;
  }

  #clock-time {
    font-size: 48px;
  }

  .bookmark-grid {
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 10px;
  }

  .bookmark-icon {
    width: 48px;
    height: 48px;
  }

  .dock-btn span {
    display: none;
  }

  #settings-panel {
    flex-direction: column;
    height: 90vh;
  }

  #settings-sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    padding: 12px;
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
  }

  #settings-user {
    display: none;
  }

  .settings-nav span {
    display: none;
  }
}

/* ===== Project Panel ===== */
#project-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 500;
}

#project-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 860px;
  max-width: 92vw;
  height: 580px;
  max-height: 88vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 510;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

#project-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  margin-right: 12px;
}

#project-header-left,
#project-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

#project-select {
  padding: 6px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  color: #374151;
  background: #fff;
  outline: none;
  cursor: pointer;
  max-width: 200px;
}

#project-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

#project-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #9ca3af;
  font-size: 15px;
}

/* Stats Cards Row */
.proj-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.proj-stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #e5e7eb;
  transition: box-shadow 0.2s;
}

.proj-stat-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.proj-stat-label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 8px;
  font-weight: 500;
}

.proj-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
}

input.proj-stat-value {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  padding: 0;
}

input.proj-stat-value::placeholder {
  color: #d1d5db;
}

input.proj-stat-value:focus {
  border-bottom: 2px solid var(--accent);
}

.proj-stat-budget { border-left: 3px solid #22c55e; }
.proj-stat-invest { border-left: 3px solid #f59e0b; }
.proj-stat-days { border-left: 3px solid #3b82f6; }
.proj-stat-progress { border-left: 3px solid #8b5cf6; }

/* Progress bar */
.proj-progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.proj-progress-wrap input[type="range"] {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 3px;
  background: #e5e7eb;
  outline: none;
}

.proj-progress-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #8b5cf6;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

#proj-progress-label {
  font-size: 18px;
  font-weight: 700;
  color: #8b5cf6;
  min-width: 40px;
}

/* Field row */
.proj-field-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  background: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
}

.proj-field-row label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}

.proj-field-row input[type="date"] {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  color: #111827;
  font-family: inherit;
  background: transparent;
}

/* Sections */
.proj-section {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  margin-bottom: 14px;
  overflow: hidden;
}

.proj-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #f3f4f6;
}

.proj-section-header h4 {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin: 0;
}

.proj-section textarea {
  width: 100%;
  border: none;
  outline: none;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.7;
  font-family: inherit;
  color: #374151;
  resize: vertical;
  min-height: 80px;
  background: transparent;
}

/* Update Log Items */
.proj-log-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #f3f4f6;
  position: relative;
}

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

.proj-log-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 5px;
}

.proj-log-body {
  flex: 1;
}

.proj-log-date {
  font-size: 11px;
  color: #9ca3af;
  margin-bottom: 4px;
}

.proj-log-text {
  font-size: 13px;
  color: #374151;
  line-height: 1.6;
}

.proj-log-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: #d1d5db;
  cursor: pointer;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s;
}

.proj-log-item:hover .proj-log-delete {
  opacity: 1;
}

.proj-log-delete:hover {
  color: #ef4444;
}

/* Add Log Modal */
.proj-log-input {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #f3f4f6;
}

.proj-log-input textarea {
  flex: 1;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  outline: none;
  min-height: 36px;
  max-height: 80px;
}

.proj-log-input textarea:focus {
  border-color: var(--accent);
}

.proj-log-input button {
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  align-self: flex-end;
}

/* Complete button */
#proj-complete-area {
  text-align: center;
  padding: 20px 0;
}

.proj-complete-btn {
  padding: 12px 36px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.proj-complete-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.4);
}

#proj-completed-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  margin: 16px 0;
}

#proj-completed-badge span {
  font-size: 16px;
  font-weight: 600;
  color: #16a34a;
}

#proj-completed-badge .btn-sm {
  font-size: 12px;
  color: #6b7280;
  background: #fff;
  border: 1px solid #d1d5db;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}

/* ===== Todo Widget on Homepage ===== */
#todo-widget {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 14px 16px;
  color: #fff;
  margin-bottom: 12px;
}

#todo-widget:empty {
  display: none;
}

.todo-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.todo-widget-title {
  font-size: 13px;
  font-weight: 600;
}

.todo-widget-count {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
}

.todo-widget-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 12px;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
}

.todo-widget-item:hover {
  color: #fff;
}

.todo-widget-check {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.3);
  flex-shrink: 0;
  transition: all 0.2s;
}

.todo-widget-item.done .todo-widget-check {
  background: #22c55e;
  border-color: #22c55e;
}

.todo-widget-item.done .todo-widget-text {
  text-decoration: line-through;
  color: rgba(255,255,255,0.3);
}

.todo-widget-text {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.todo-widget-more {
  text-align: center;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: 6px;
}

.todo-widget-more span {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
}

.todo-widget-more span:hover {
  color: rgba(255,255,255,0.7);
}

/* ===== Project Widget on Homepage ===== */
#project-widget {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.proj-widget-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  color: #fff;
}

.proj-widget-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.proj-widget-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.proj-widget-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.proj-widget-status.running {
  background: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

.proj-widget-status.done {
  background: rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.proj-widget-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 10px;
}

.proj-widget-stat {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
}

.proj-widget-stat strong {
  display: block;
  font-size: 16px;
  color: #fff;
  font-weight: 700;
}

/* Issue-Solution pairs */
.proj-issue-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f3f4f6;
  position: relative;
}

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

.proj-issue-problem {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.proj-issue-problem::before {
  content: '⚠️';
  flex-shrink: 0;
}

.proj-issue-problem span {
  font-size: 13px;
  color: #dc2626;
  font-weight: 500;
  line-height: 1.5;
}

.proj-issue-solution {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding-left: 4px;
}

.proj-issue-solution::before {
  content: '💡';
  flex-shrink: 0;
}

.proj-issue-solution span {
  font-size: 13px;
  color: #16a34a;
  line-height: 1.5;
}

.proj-issue-del {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: #d1d5db;
  cursor: pointer;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s;
}

.proj-issue-item:hover .proj-issue-del {
  opacity: 1;
}

.proj-issue-del:hover {
  color: #ef4444;
}

.proj-issue-input {
  padding: 12px 16px;
  border-top: 1px solid #f3f4f6;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.proj-issue-input input {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.proj-issue-input input:focus {
  border-color: var(--accent);
}

.proj-issue-input-actions {
  display: flex;
  justify-content: flex-end;
}

.proj-issue-input-actions button {
  padding: 6px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}

/* Expense items */
.proj-expense-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
  color: #374151;
  position: relative;
}

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

.proj-expense-amount {
  font-weight: 700;
  color: #ef4444;
  min-width: 80px;
}

.proj-expense-desc {
  flex: 1;
  margin-left: 12px;
  color: #6b7280;
}

.proj-expense-date {
  font-size: 11px;
  color: #9ca3af;
  margin-left: 12px;
}

.proj-expense-del {
  background: none;
  border: none;
  color: #d1d5db;
  cursor: pointer;
  font-size: 14px;
  margin-left: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}

.proj-expense-item:hover .proj-expense-del {
  opacity: 1;
}

.proj-expense-del:hover {
  color: #ef4444;
}

.proj-expense-input {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #f3f4f6;
  align-items: center;
}

.proj-expense-input input {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.proj-expense-input input:focus {
  border-color: var(--accent);
}

.proj-expense-input input:first-child {
  width: 90px;
}

.proj-expense-input input:nth-child(2) {
  flex: 1;
}

.proj-expense-input button {
  padding: 8px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

.proj-widget-log {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 8px;
  line-height: 1.4;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.proj-widget-bar {
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  overflow: hidden;
}

.proj-widget-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  transition: width 0.3s;
}

.proj-widget-card.completed .proj-widget-bar-fill {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

@media (max-width: 768px) {
  .proj-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  #project-panel {
    width: 96vw;
    height: 90vh;
  }

  #home-right {
    position: static;
    width: 100%;
    height: auto;
    padding: 12px;
  }

  #content {
    padding-right: 20px;
  }
}
