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

html, body { height: 100%; overflow: hidden; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: #f8f9fa;
  color: #1a1a1a;
  line-height: 1.5;
}

todo-app {
  display: flex;
  height: 100vh;
}

/* ---- Login page (full-screen, no sidebar) ---- */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100vh;
}

/* ---- Sidebar ---- */

.sidebar {
  width: 220px;
  min-width: 220px;
  background: #f0f0f0;
  border-right: 1px solid #ddd;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}
.sidebar.sidebar-collapsed {
  width: 40px;
  min-width: 40px;
  cursor: pointer;
  align-items: center;
  overflow: hidden;
}
.sidebar-expand {
  padding: 0.75rem 0;
  font-size: 1.1rem;
  color: #888;
}
.sidebar-collapsed:hover { background: #e8e8e8; }
.sidebar-collapsed:hover .sidebar-expand { color: #555; }
.icon-btn {
  background: none;
  border: none;
  font-size: 1rem;
  color: #bbb;
  cursor: pointer;
  padding: 0.15rem 0.4rem;
  line-height: 1;
  border-radius: 4px;
}
.icon-btn:hover { color: #666; background: #e0e0e0; }
.sidebar-header {
  padding: 0.5rem 0.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
}
.mode-switcher {
  display: flex;
  background: #e4e4e4;
  border-radius: 6px;
  padding: 2px;
}
.mode-tab {
  padding: 0.25rem 0.6rem;
  border: none;
  background: none;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  color: #888;
  cursor: pointer;
  transition: all 0.15s;
}
.mode-tab:hover { color: #555; }
.mode-tab.active {
  background: #fff;
  color: #333;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.sidebar-empty {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  color: #bbb;
  font-style: italic;
}
.sidebar-section {
  padding: 0.25rem 0;
}
.sidebar-label {
  padding: 0.3rem 1rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #999;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sidebar-item {
  padding: 0.35rem 1rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: #555;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.1s;
}
.sidebar-item:hover { background: #e6e6e6; }
.sidebar-item.active { background: #e0e0e0; color: #111; font-weight: 500; }
.sidebar-item .count {
  font-size: 0.7rem;
  color: #999;
  margin-left: auto;
}
.sidebar-bottom {
  margin-top: auto;
}
.sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid #ddd;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: #777;
}
.timer-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4caf50;
  display: inline-block;
  flex-shrink: 0;
}

.sidebar-footer-profile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.sidebar-footer-profile:hover { color: #333; }
.sidebar-auth-info {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
}
.auth-email { color: #999; overflow: hidden; text-overflow: ellipsis; }
.auth-signout {
  background: none; border: none; color: #bbb; cursor: pointer;
  font-size: 0.7rem; padding: 0;
}
.auth-signout:hover { color: #c00; }
.auth-login-btn {
  background: none; border: 1px solid #ddd; border-radius: 4px;
  padding: 0.2rem 0.6rem; cursor: pointer; font-size: 0.75rem; color: #666;
}
.auth-login-btn:hover { background: #f0f0f0; }
.sidebar-status-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
}
.sync-status {
  padding: 0.1rem 0.4rem;
  border-radius: 1rem;
  font-size: 0.6rem;
  font-weight: 500;
}
.sync-status.synced { background: #d4edda; color: #155724; }
.sync-status.pending { background: #fff3cd; color: #856404; }
.sync-status.offline { background: #f8d7da; color: #721c24; }
.sidebar-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
}

/* ---- Main layer ---- */

.main-layer {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
.main-layer.main-row,
.main-row {
  display: flex;
  flex-direction: row;
}

/* ---- Content area ---- */

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  max-width: 720px;
}

/* ---- Header ---- */

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e9ecef;
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.project-name {
  font-size: 0.8rem;
  color: #6c63ff;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  background: #f0eeff;
  border-radius: 4px;
}
.project-name:hover { background: #e4e0ff; cursor: pointer; }

.header-right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.avatar-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
  color: #fff;
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: box-shadow 0.15s;
}
.avatar-btn:hover { box-shadow: 0 0 0 2px #6c63ff; }

.status {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 1rem;
  font-weight: 500;
}
.status.synced { background: #d4edda; color: #155724; }
.status.pending { background: #fff3cd; color: #856404; }
.status.offline { background: #f8d7da; color: #721c24; }

.peer-count {
  font-size: 0.7rem;
  color: #6c63ff;
}

/* ---- Triage view ---- */

.triage-view {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
}
.triage-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1rem;
}
.triage-header h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}
.triage-count {
  font-size: 0.8rem;
  color: #888;
}
.triage-list {
  display: flex;
  flex-direction: column;
}

/* ---- Saved view ---- */

.saved-view-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.saved-view-filters {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 1rem 0.75rem;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 0.75rem;
  color: #888;
  font-weight: 500;
}

/* ---- Views (Profile, Projects) ---- */

.view-panel {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.view-panel h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #333;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 320px;
}
.form-stack label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #555;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.form-stack input[type=text] {
  padding: 0.45rem 0.65rem;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font-size: 0.85rem;
  transition: border-color 0.15s;
}
.form-stack input[type=text]:focus {
  border-color: #6c63ff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(108,99,255,0.1);
}

.color-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.color-row input[type=color] {
  width: 38px;
  height: 30px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  padding: 2px;
  cursor: pointer;
}
.color-preview {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
}

.project-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 1rem;
}
.project-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.1s;
}
.project-item:hover { background: #f5f5f5; }
.project-item.active {
  background: #f0eeff;
  color: #6c63ff;
  font-weight: 600;
}
.project-item .delete-btn {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 1rem;
  padding: 0 0.25rem;
}
.project-item .delete-btn:hover { color: #e53e3e; }

.add-project {
  display: flex;
  gap: 0.5rem;
}
.add-project input {
  flex: 1;
  padding: 0.45rem 0.65rem;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font-size: 0.85rem;
}
.add-project input:focus {
  border-color: #6c63ff;
  outline: none;
}

/* ---- Search + Tag filter ---- */

.search-bar { margin-bottom: 0.75rem; }
.search-input {
  width: 100%;
  padding: 0.45rem 0.75rem;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font-size: 0.85rem;
  transition: border-color 0.15s;
}
.search-input:focus {
  border-color: #6c63ff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(108,99,255,0.1);
}

.tag-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}
.tag-pill {
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 1rem;
  border: 1px solid #d0d5dd;
  background: #fff;
  color: #555;
  cursor: pointer;
  transition: all 0.1s;
}
.tag-pill:hover { background: #f5f5f5; border-color: #aaa; }
.tag-pill.active {
  background: #6c63ff;
  color: #fff;
  border-color: #6c63ff;
}

/* ---- Add form ---- */

.add-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  align-items: flex-start;
}
.form-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.form-fields input {
  padding: 0.5rem 0.75rem;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: border-color 0.15s;
}
.form-fields input:focus {
  border-color: #6c63ff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(108,99,255,0.1);
}
.form-extras input { font-size: 0.8rem; }
.input-title { font-weight: 500; }

button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  background: #6c63ff;
  color: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.15s;
}
button:hover { background: #5b52e0; }
button:disabled { background: #c4c1e0; cursor: default; }

/* ---- Task list ---- */

.tasks {
  display: flex;
  flex-direction: column;
}

.task-wrapper {
  cursor: grab;
  transition: transform 0.15s, opacity 0.15s;
}
.task-wrapper.dragging { opacity: 0.35; }
.task-wrapper.drag-over {
  border-top: 2px solid #6c63ff;
  padding-top: 0.2rem;
}
.task-wrapper:active { cursor: grabbing; }
.task-wrapper.peer-dragging {
  outline: 2px dashed #6c63ff;
  outline-offset: 2px;
  opacity: 0.7;
}
.task-wrapper.peer-drag-over {
  border-top: 2px solid #6c63ff;
  padding-top: 0.2rem;
}
.task-wrapper.selected {
  /* selection styled inside task-card shadow DOM */
}
.project-item.selected {
  background: rgba(0, 0, 0, 0.03);
}

.peer-indicator {
  font-size: 0.7rem;
  color: #6c63ff;
  padding: 0.1rem 0.75rem;
  font-style: italic;
}

.empty {
  text-align: center;
  color: #aaa;
  padding: 2.5rem;
  font-size: 0.85rem;
}

footer {
  margin-top: 2rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e9ecef;
  font-size: 0.7rem;
  color: #999;
  display: flex;
  justify-content: space-between;
}

/* ---- Shortcut hints ---- */

.shortcut-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}

.shortcut-hints {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  max-width: 720px;
}

.hint-columns {
  display: flex;
  gap: 1.5rem;
}
.hint-col {
  flex: 1;
  min-width: 180px;
}
.hint-section {
  font-weight: 600;
  color: #666;
  font-size: 0.78rem;
  margin-bottom: 0.2rem;
  margin-top: 0.5rem;
}
.hint-col .hint-section:first-child { margin-top: 0; }

.hint-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  font-size: 0.78rem;
  color: #555;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 0.15rem 0.45rem;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: #333;
  background: #f5f5f5;
  border: 1px solid #d0d5dd;
  border-radius: 4px;
  box-shadow: 0 1px 0 #d0d5dd;
}

.view-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
}
.view-toggle button {
  flex: 1;
  padding: 0.4rem 0.75rem;
  border: none;
  background: #f8f8f8;
  font-size: 0.8rem;
  cursor: pointer;
  color: #888;
  transition: all 0.1s;
}
.view-toggle button.active {
  background: #fff;
  color: #333;
  font-weight: 500;
}
.view-toggle button:not(.active):hover {
  background: #f0f0f0;
}
.view-toggle .count {
  font-size: 0.7rem;
  background: #e9ecef;
  padding: 0.05rem 0.4rem;
  border-radius: 1rem;
  margin-left: 0.3rem;
}
.view-toggle button.active .count {
  background: #333;
  color: #fff;
}

.sidebar-new-project {
  padding: 0.25rem 0.75rem;
}
.sidebar-new-project input {
  width: 100%;
  padding: 0.3rem 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: inherit;
  background: #fff;
}
.sidebar-new-project input:focus {
  outline: none;
  border-color: #999;
}

.move-picker-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.move-picker {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  min-width: 240px;
  overflow: hidden;
}
.move-picker-title {
  padding: 0.6rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #666;
  border-bottom: 1px solid #eee;
}
.move-picker-item {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  cursor: pointer;
}
.move-picker-item:hover { background: #f5f5f5; }
.move-picker-item.active { background: #f0f0f0; }
.move-picker-item.current { color: #aaa; cursor: default; }
.move-picker-item.current:hover { background: transparent; }
.move-current { font-size: 0.7rem; color: #bbb; margin-left: 0.3rem; }

.sidebar-key {
  font-size: 0.65rem;
  color: #bbb;
  background: #e8e8e8;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: inherit;
}
.sidebar-item.active .sidebar-key {
  color: #888;
  background: #d8d8d8;
}

/* ---- View toggle bar (list/week toggle) ---- */

/* ---- Search bar ---- */

.search-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-bottom: 1px solid #eee;
  background: #fafafa;
  flex-shrink: 0;
}
.search-icon {
  font-size: 0.75rem;
  color: #bbb;
  font-weight: 600;
  width: 18px;
  text-align: center;
}
.search-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 0.3rem 0.5rem;
  font-size: 0.82rem;
  outline: none;
}
.search-input:focus { border-color: #6c63ff; }
.search-clear {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  line-height: 1;
}
.search-clear:hover { color: #999; }

.view-toggle-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid #eee;
  background: #fafafa;
  flex-shrink: 0;
  width: 100%;
}
.view-toggle-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #444;
}
.view-toggle-actions {
  display: flex;
  gap: 0.2rem;
  margin-left: 0.5rem;
}
.view-action-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0.15rem 0.35rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: #888;
  transition: all 0.1s;
}
.view-action-btn:hover { color: #333; border-color: #ddd; }
.view-action-btn.active { color: #6c63ff; border-color: #6c63ff; }

.view-toggle-tabs {
  display: flex;
  gap: 0.15rem;
  background: #eee;
  border-radius: 5px;
  padding: 2px;
}
.view-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 24px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #999;
  cursor: pointer;
  transition: all 0.15s;
}
.view-tab:hover { color: #555; }
.view-tab.active {
  background: #fff;
  color: #333;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* ---- Estimate popover ---- */

.estimate-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.15);
}
.estimate-popover {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  padding: 1rem;
  min-width: 300px;
  max-width: 380px;
}
.estimate-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}
.estimate-header span:first-child { flex: 1; }
.est-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #999;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.est-close:hover { color: #333; }

.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}
.preset-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fafafa;
  color: #333;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.1s;
}
.preset-btn:hover { border-color: #aaa; background: #f0f0f0; }
.preset-key {
  font-size: 0.65rem;
  background: #e8e8e8;
  color: #666;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.est-custom {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: #666;
  margin-bottom: 0.5rem;
}
.est-custom input {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 0.3rem 0.4rem;
  font-size: 0.8rem;
  outline: none;
}
.est-custom input:focus { border-color: #6c63ff; }

.est-btn {
  padding: 0.3rem 0.7rem;
  border: 1px solid #ddd;
  border-radius: 5px;
  background: #fafafa;
  color: #333;
  cursor: pointer;
  font-size: 0.78rem;
  transition: all 0.1s;
}
.est-btn:hover { border-color: #aaa; }
.est-btn.est-primary {
  background: #6c63ff;
  color: #fff;
  border-color: #6c63ff;
}
.est-btn.est-primary:hover { background: #5a52e0; }
.est-btn.est-start {
  background: #e8f5e9;
  color: #2e7d32;
  border-color: #a5d6a7;
}
.est-btn.est-start:hover { background: #c8e6c9; }

.est-link {
  background: none;
  border: none;
  color: #999;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
}
.est-link:hover { color: #6c63ff; }
.est-link-row {
  display: flex;
  gap: 1rem;
}

/* Progress section */
.progress-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}
.progress-bar {
  flex: 1;
  height: 8px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: #6c63ff;
  border-radius: 4px;
  transition: width 0.2s;
}
.progress-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #666;
  min-width: 2.5rem;
  text-align: right;
}
.progress-stats {
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 0.75rem;
}

.quick-log-btns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.timer-display {
  font-size: 0.85rem;
  font-weight: 600;
  color: #2e7d32;
  font-variant-numeric: tabular-nums;
}

.estimate-actions {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

/* Preset editor */
.preset-list { margin-bottom: 0.5rem; }
.preset-edit-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.3rem;
  font-size: 0.8rem;
}
.preset-edit-row input {
  width: 4rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 0.25rem 0.35rem;
  font-size: 0.8rem;
}
.preset-del {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 1rem;
}
.preset-del:hover { color: #e63946; }

/* milestone-sidebar is now a Lit component with its own Shadow DOM styles */

/* ---- Schedule settings ---- */

.sched-day-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
}
.sched-day-tab {
  padding: 0.3rem 0.6rem;
  border: 1px solid #ddd;
  border-radius: 5px;
  background: #fafafa;
  color: #666;
  cursor: pointer;
  font-size: 0.78rem;
  transition: all 0.1s;
}
.sched-day-tab:hover { border-color: #aaa; }
.sched-day-tab.active {
  background: #6c63ff;
  color: #fff;
  border-color: #6c63ff;
}
.sched-day-tab.has-blocks:not(.active) {
  border-color: #b0adff;
  color: #6c63ff;
}

.sched-day-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: #333;
  margin-bottom: 0.5rem;
}

.sched-block-list { margin-bottom: 0.5rem; }
.sched-block-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid #eee;
  border-radius: 5px;
  margin-bottom: 0.3rem;
  font-size: 0.82rem;
}
.sched-block-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sched-block-time {
  color: #555;
  font-variant-numeric: tabular-nums;
}
.sched-block-project {
  flex: 1;
  color: #333;
  font-weight: 500;
}
.sched-block-del {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  line-height: 1;
}
.sched-block-del:hover { color: #e63946; }

.sched-total {
  font-size: 0.78rem;
  color: #888;
  margin-bottom: 0.75rem;
}

.sched-empty {
  font-size: 0.82rem;
  color: #bbb;
  font-style: italic;
  margin-bottom: 0.75rem;
}

.sched-add-form {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.sched-add-form input[type=time],
.sched-add-form select {
  padding: 0.3rem 0.4rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.8rem;
}
.sched-add-form select { min-width: 8rem; }
.sched-add-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: #666;
  margin-right: 0.2rem;
}

.sched-error {
  font-size: 0.78rem;
  color: #e63946;
  margin-bottom: 0.5rem;
}

.sched-divider {
  height: 1px;
  background: #eee;
  margin: 1rem 0;
}

.sched-section-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #333;
  margin: 0 0 0.75rem;
}

.sched-override-list { margin-bottom: 0.75rem; }
.sched-override-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid #eee;
  border-radius: 5px;
  margin-bottom: 0.3rem;
  font-size: 0.82rem;
}
.sched-override-date {
  font-weight: 500;
  color: #333;
  min-width: 7rem;
}
.sched-override-summary {
  flex: 1;
  color: #666;
}

.sched-add-override {
  margin-bottom: 1rem;
}
.sched-override-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.3rem;
}
.sched-override-form input[type=date] {
  padding: 0.3rem 0.4rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.8rem;
  max-width: 12rem;
}
.sched-override-type {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: #555;
}
.sched-override-type label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
}

.sched-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* ---- Task list panel (middle, Apple Notes style) ---- */

.task-list-panel {
  width: 260px;
  min-width: 260px;
  border-right: 1px solid #eee;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: #fcfcfc;
  transition: background 0.15s;
}
.task-list-panel.drag-over {
  background: #f0f0ff;
  border-right-color: #ccc;
}
.task-list-panel.task-list-collapsed {
  width: 40px;
  min-width: 40px;
  cursor: pointer;
  align-items: center;
  overflow: hidden;
}
.task-list-panel.task-list-collapsed:hover { background: #f0f0f0; }
.task-list-header {
  padding: 0.6rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.task-list-items {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0;
}
.task-list-item {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.1s;
}
.task-list-item:hover { background: #f5f5f5; }
.task-list-item.selected { background: #eee; }
.task-list-item.done { opacity: 0.4; }
.task-list-check { cursor: pointer; user-select: none; font-size: 1rem; }
.task-list-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.task-list-item.done .task-list-title { text-decoration: line-through; }
.task-list-sep { height: 1px; background: #eee; margin: 0.3rem 0.75rem; }
.task-list-empty {
  padding: 1rem;
  font-size: 0.8rem;
  color: #ccc;
  text-align: center;
}

/* ---- Command palette ---- */

/* ---- Notes view ---- */

.notes-container {
  display: flex;
  flex: 1;
  min-height: 0;
}
.notes-list {
  width: 280px;
  min-width: 280px;
  border-right: 1px solid #eee;
  display: flex;
  flex-direction: column;
  background: #fafafa;
}
.notes-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  font-size: 0.82rem;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}
.notes-list-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem;
}
.note-item {
  padding: 0.5rem 0.65rem;
  border-radius: 5px;
  cursor: pointer;
  margin-bottom: 1px;
}
.note-item:hover { background: #f0f0f0; }
.note-item.selected { background: #e8e8e8; }
.note-item-title {
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-item-preview {
  font-size: 0.7rem;
  color: #999;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.1rem;
}
.note-item-tags {
  display: flex;
  gap: 0.2rem;
  margin-top: 0.2rem;
}
.note-tag {
  font-size: 0.6rem;
  padding: 0.05rem 0.3rem;
  border-radius: 1rem;
  background: #e9ecef;
  color: #495057;
}
.notes-empty {
  padding: 1.5rem 0.75rem;
  color: #bbb;
  font-size: 0.8rem;
  text-align: center;
}
.notes-empty kbd {
  background: #eee;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.75rem;
}
.note-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.note-editor-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #bbb;
  font-size: 0.85rem;
}
.note-editor-empty kbd {
  background: #eee;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.75rem;
}
.note-editor-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}
.note-editor-header .icon-btn:last-child { margin-left: auto; }
.note-title-input {
  flex: 1;
  border: none;
  font-size: 1.1rem;
  font-weight: 600;
  font-family: inherit;
  outline: none;
  background: transparent;
}
.note-editor-tags {
  padding: 0.3rem 0.75rem;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.note-editor-tags-label {
  font-size: 0.65rem;
  color: #999;
  font-weight: 500;
  flex-shrink: 0;
}
.note-editor-tags tag-input {
  flex: 1;
  --tag-input-border: none;
}

/* ---- Board ---- */

.board-filter-bar {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  font-size: 0.8rem;
}
.board-filter-input {
  border: none;
  outline: none;
  font-size: 0.8rem;
  width: 200px;
  font-family: inherit;
}

.board-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
}
.pdf-sidebar-viewer {
  flex: 1;
  display: flex;
  min-height: 0;
}
.board-sidebar-editor {
  width: 560px;
  min-width: 320px;
  max-width: 80vw;
  border-left: 1px solid #eee;
  display: flex;
  flex-direction: column;
  background: #fff;
  position: relative;
}
.sidebar-resize-handle {
  position: absolute;
  left: -3px;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 20;
}
.sidebar-resize-handle:hover,
.sidebar-resize-handle.active {
  background: #6c63ff;
  opacity: 0.3;
}

/* ---- Board note search ---- */

.board-note-search-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  z-index: 300;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 18vh;
}
.board-note-search {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.18);
  width: 440px;
  border: 1px solid #e0e0e0;
  overflow: hidden;
}
.board-note-search-results {
  max-height: 300px;
  overflow-y: auto;
}
.board-note-search-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  border-bottom: 1px solid #f0f0f0;
}
.board-note-search-item:hover { background: #f5f5f5; }
.board-note-search-title { font-size: 0.82rem; font-weight: 500; }
.board-note-search-preview { font-size: 0.7rem; color: #999; }
.board-note-search-empty { padding: 0.75rem; color: #bbb; font-size: 0.8rem; text-align: center; }

/* ---- Slash command popup ---- */

.slash-popup {
  position: fixed;
  z-index: 400;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 220px;
  max-height: 300px;
  overflow-y: auto;
  padding: 0.25rem;
}
.slash-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 5px;
  cursor: pointer;
}
.slash-item:hover, .slash-item.active { background: #f0f0f0; }
.slash-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #666;
  flex-shrink: 0;
}
.slash-item-text { display: flex; flex-direction: column; }
.slash-title { font-size: 0.8rem; font-weight: 500; }
.slash-desc { font-size: 0.65rem; color: #999; }
.slash-empty { padding: 0.5rem; color: #bbb; font-size: 0.8rem; text-align: center; }

/* ---- Backlinks ---- */

.backlinks-panel {
  border-top: 1px solid #eee;
  padding: 0.5rem 0.75rem;
  flex-shrink: 0;
}
.backlinks-header {
  font-size: 0.7rem;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.3rem;
}
.backlink-item {
  font-size: 0.78rem;
  padding: 0.25rem 0.4rem;
  border-radius: 3px;
  cursor: pointer;
  color: #6c63ff;
}
.backlink-item:hover { background: #f0f0f0; }

/* ---- Timer footer ---- */

.timer-footer {
  display: flex;
  gap: 0;
  background: #f0fdf0;
  border-bottom: 1px solid #c8e6c9;
  overflow-x: auto;
  flex-shrink: 0;
}
.timer-footer-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  font-size: 0.75rem;
  white-space: nowrap;
  border-right: 1px solid #c8e6c9;
}
.timer-footer-item:hover { background: #e8f5e9; }
.timer-footer-item.peer { opacity: 0.6; }
.timer-footer-title {
  font-weight: 500;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timer-footer-project {
  font-size: 0.65rem;
  color: #2e7d32;
  padding: 0.1rem 0.3rem;
  background: #c8e6c9;
  border-radius: 1rem;
}
.timer-footer-peer {
  font-size: 0.65rem;
  color: #888;
}

/* ---- Inbox capture ---- */

.inbox-capture-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  z-index: 300;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 18vh;
}
.inbox-capture {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.18);
  width: 440px;
  border: 1px solid #e0e0e0;
}
.inbox-capture-label {
  padding: 0.5rem 0.75rem 0;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #999;
  font-weight: 500;
}
.inbox-capture-input {
  width: 100%;
  padding: 0.45rem 0.75rem 0.55rem;
  border: none;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}

.command-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 300;
  display: flex;
  justify-content: center;
  padding-top: 15vh;
}
.command-palette {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
  width: 480px;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.command-input {
  padding: 0.75rem 1rem;
  border: none;
  border-bottom: 1px solid #eee;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
}
.command-results {
  overflow-y: auto;
  padding: 0.25rem 0;
}
.command-section {
  padding: 0.4rem 1rem 0.2rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #999;
}
.command-item {
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.command-item:hover,
.command-item.active { background: #f5f5f5; }
.command-icon { font-size: 0.85rem; flex-shrink: 0; }
.command-empty {
  padding: 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: #bbb;
}

.mit-badge {
  font-size: 0.6rem;
  background: #e63946;
  color: #fff;
  padding: 0.05rem 0.35rem;
  border-radius: 1rem;
  margin-left: auto;
  font-weight: 600;
}
.sidebar-item .mit-badge { margin-left: auto; }
.sidebar-item .mit-badge + .count { margin-left: 0.3rem; }

.project-edit-btn {
  background: none;
  border: none;
  font-size: 0.7rem;
  color: transparent;
  cursor: pointer;
  padding: 0.15rem 0.4rem;
  line-height: 1;
  border-radius: 4px;
}
.sidebar-item:hover .project-edit-btn { color: #bbb; }
.project-edit-btn:hover { color: #666 !important; background: #e0e0e0; }

/* Library view */
.library-filter-btn {
  padding: 0.4rem 0.75rem;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: #fafafa;
  cursor: pointer;
  font-size: 0.8rem;
  color: #555;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s;
}
.library-filter-btn:hover { background: #f0f0f0; border-color: #ccc; }
.library-filter-btn.active { background: #333; color: #fff; border-color: #333; }
.library-filter-btn.active .library-filter-count { background: rgba(255,255,255,0.2); color: #fff; }
.library-filter-count {
  font-size: 0.7rem;
  background: #e8e8e8;
  color: #666;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
}
.library-list { display: flex; flex-direction: column; gap: 2px; }
.library-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #eee;
}
.library-item:hover { background: #f8f8f8; }
.library-item-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  min-width: 0;
}
.library-item-title {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.library-item-meta {
  font-size: 0.72rem;
  color: #888;
}
.library-item-active { background: #eef; border-color: #cce; }
.library-item-selected { background: #e8f0ff; border-color: #b8d4ff; }
.library-move-picker {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: #fff; border: 1px solid #ddd; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15); width: 260px; max-height: 300px;
  display: flex; flex-direction: column; z-index: 100;
}
.library-move-search {
  width: 100%; border: none; padding: 0.5rem; font-size: 0.85rem;
  outline: none; box-sizing: border-box;
}
.library-move-list { overflow-y: auto; max-height: 220px; }
.library-move-item {
  padding: 0.4rem 0.75rem; cursor: pointer; font-size: 0.83rem;
}
.library-move-item:hover { background: #f5f5f5; }
.library-move-item.active { background: #e8f0ff; }
.library-delete {
  opacity: 0;
  color: #c00;
  transition: opacity 0.15s;
}
.library-item:hover .library-delete { opacity: 1; }
