body {
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  background-color: #f5f5f5;
  color: #333;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#header {
  display: flex;
  align-items: center;
  padding: 10px 8px 10px 20px;
  background-color: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#logo {
  font-size: 2rem;
  font-weight: 700;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Sync-status dot shown next to the project name */
.sync-status {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-bottom: -1px; /* optical alignment with text baseline */
}

.sync-status.hidden {
  display: none;
}

.sync-status--online {
  background: #4caf50;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.25);
}

.sync-status--offline {
  background: #9e9e9e;
  box-shadow: 0 0 0 2px rgba(158, 158, 158, 0.25);
}

#settings-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #666;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s;
  border-radius: 8px;
}

#settings-btn:hover {
  color: #222;
}

#settings-btn svg {
  width: 24px;
  height: 24px;
  display: block;
}

/* ── Navigation Menu ────────────────────────────────────── */

#nav-menu-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

#nav-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #666;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s;
  border-radius: 8px;
}

#nav-menu-btn:hover {
  color: #222;
}

#nav-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 500;
  min-width: 200px;
  overflow: hidden;
}

#nav-menu.hidden {
  display: none;
}

#nav-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: #555;
  text-decoration: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  transition: background 0.15s, color 0.15s;
}

#nav-menu a:hover {
  background: #f5f5f5;
  color: #111;
}

#nav-menu a.active {
  color: #4CAF50;
  font-weight: 700;
}

#nav-menu a.active svg {
  color: #4CAF50;
}

#settings {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

#settings.hidden {
  display: none;
}

#settings-content {
  background: white;
  padding: 20px;
  border-radius: 10px;
  width: 80%;
  max-width: 300px;
  text-align: center;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  color: #999;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.modal-close:hover {
  color: #333;
  background: rgba(0, 0, 0, 0.07);
}

#project-name {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  box-sizing: border-box;
}

#theme-select,
#project-switch,
#voice-lang-select {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  box-sizing: border-box;
}

#save-name {
  background-color: #4CAF50;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
}

#todo-list {
  flex: 1;
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
}

#todo-list li {
  display: flex;
  align-items: center;
  background: white;
  margin-bottom: 3px;
  padding: 10px;
}

.todo-checkbox {
  margin-right: 10px;
}

.todo-text {
  flex: 1;
}

.done {
  color: #ccc;
  text-decoration: line-through;
}

.editing {
  border: 2px solid #2196F3;
  box-shadow: inset 0 0 0 1px #2196F3;
  background: #e3f2fd;
}

#item-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

#item-menu.hidden {
  display: none;
}

#item-menu-content {
  background: white;
  padding: 10px;
  border-radius: 10px;
  width: 80%;
  max-width: 300px;
  text-align: center;
  position: relative;
}

#delete-item {
  background-color: #f44336;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  margin: 5px;
}

#move-up {
  background-color: #2196F3;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  margin: 5px;
}

.more-btn {
  background: none;
  border: none;
  cursor: pointer;
  margin-left: auto;
  color: #666;
}

.more-btn svg {
  width: 24px;
  height: 24px;
}

.show-more-item {
  background: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.show-more-btn {
  display: block;
  width: 100%;
  padding: 10px;
  background: none;
  border: none;
  border-top: 1px solid #eee;
  cursor: pointer;
  color: #999;
  font-family: inherit;
  font-size: 0.85rem;
  text-align: center;
}

.show-more-btn:hover {
  background: #f5f5f5;
  color: #555;
}

#mic-hint {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.75rem;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  z-index: 100;
  line-height: 1.8;
  pointer-events: none;
}

#mic-hint.visible {
  display: block;
}

#mic-hint kbd {
  font-family: inherit;
  background: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 0.72rem;
}

#input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: white;
  margin: 3px 0;
  transition: outline 0.15s;
}

#input-wrapper.listening {
  outline: 2px solid rgba(244, 67, 54, 0.4);
  outline-offset: -2px;
}

#mic-btn {
  position: absolute;
  left: 12px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  color: #bbb;
  z-index: 1;
  transition: color 0.2s;
}

#mic-btn:hover:not(:disabled) {
  color: #666;
}

#mic-btn.listening {
  color: #f44336;
  animation: mic-pulse 1.2s ease-in-out infinite;
}

#mic-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

@keyframes mic-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.45; transform: scale(0.82); }
}

#todo-input {
  flex: 1;
  padding: 15px 20px 15px 40px;
  border: 0;
  background: transparent;
  box-sizing: border-box;
  font-size: 1rem;
  outline: none;
}

#todo-list a {
  color: #1a73e8;
  text-decoration: underline;
}

.todo-tag {
  --tag-color: #666;
  display: inline-block;
  color: var(--tag-color);
  background-color: color-mix(in srgb, var(--tag-color) 12%, transparent);
  border: 1.5px solid var(--tag-color);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  vertical-align: middle;
  line-height: 1.6;
  transition: background-color 0.15s;
}

.todo-tag:hover {
  background-color: color-mix(in srgb, var(--tag-color) 22%, transparent);
}

#tag-filter-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  background: #e8f0fe;
  font-size: 0.9rem;
}

#clear-tag-filter {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: #666;
  padding: 0 4px;
}

#clear-tag-filter:hover {
  color: #333;
}

@media (min-width: 768px) {
  #todo-list {
    margin-bottom: 0;
  }
}

.app-version {
  margin-top: 16px;
  font-size: 11px;
  color: #999;
  text-align: center;
}
/* Confirm dialog */
#confirm-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1100;
}

#confirm-dialog.hidden {
  display: none;
}

#confirm-dialog-content {
  background: white;
  padding: 24px;
  border-radius: 10px;
  width: 80%;
  max-width: 340px;
  text-align: center;
}

#confirm-dialog-message {
  margin: 0 0 20px;
  white-space: pre-line;
}

#confirm-dialog-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

#confirm-dialog-yes {
  background-color: #f44336;
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
}

#confirm-dialog-no {
  background-color: #e0e0e0;
  color: #333;
  border: none;
  padding: 10px 24px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
}

/* Danger button (e.g. Delete Project in settings) */
.danger-btn {
  background-color: #f44336;
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
}

.danger-btn:hover {
  background-color: #d32f2f;
}

/* Inline title editor input */
#logo-edit-input {
  background: transparent;
  border: none;
  border-bottom: 2px solid currentColor;
  font: inherit;
  color: inherit;
  width: 100%;
  box-sizing: border-box;
  outline: none;
  text-align: left;
}

/* Settings button badge */
#settings-btn-wrapper {
  position: relative;
  display: inline-flex;
}

#settings-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: #f44336;
  border-radius: 50%;
  pointer-events: none;
}

#settings-badge.hidden {
  display: none;
}

/* Settings modal action button */
.settings-link-btn {
  background: none;
  border: 1px solid #ccc;
  border-radius: 6px;
  color: #444;
  cursor: pointer;
  font-size: 13px;
  padding: 6px 12px;
  width: 100%;
  text-align: left;
  text-decoration: none;
}

.settings-link-btn:hover {
  background: #f0f0f0;
  border-color: #aaa;
}

.settings-link-btn.disabled,
.settings-link-btn:disabled {
  color: #bbb;
  border-color: #e0e0e0;
  cursor: not-allowed;
  background: none;
}

.settings-divider {
  border: none;
  border-top: 1px solid #eee;
  margin: 12px 0;
}

.settings-divider--danger {
  border-top-color: #ffdada;
  margin-top: 16px;
}

.settings-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #999;
  margin: 0 0 10px;
}

/* Tag autocomplete dropdown */
#tag-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  list-style: none;
  margin: 4px 0 0;
  padding: 4px 0;
  z-index: 200;
  max-height: 180px;
  overflow-y: auto;
}

#tag-suggestions.hidden {
  display: none;
}

#tag-suggestions li {
  padding: 7px 14px;
  cursor: pointer;
  font-size: 14px;
  color: #333;
}

#tag-suggestions li:hover,
#tag-suggestions li.active {
  background: #f5f5f5;
}

/* ── Voice cancel overlay ────────────────────────────────────────────────── */
#voice-cancel-overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 25vh;
  min-height: 110px;
  max-height: 200px;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid #e0e0e0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  backdrop-filter: blur(4px);
  animation: slideUpOverlay 0.2s ease-out;
}

#voice-cancel-overlay.hidden {
  display: none;
}

@keyframes slideUpOverlay {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

#voice-cancel-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 0 24px;
}

#voice-cancel-hint {
  font-size: 0.8rem;
  color: #888;
  text-align: center;
  line-height: 1.6;
}

#voice-cancel-hint kbd {
  font-family: inherit;
  background: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 0.75rem;
}

#voice-cancel-btn {
  background: #f44336;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 28px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

#voice-cancel-btn:hover {
  background: #d32f2f;
}

/* Export Markdown button */
#export-md-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  color: inherit;
  display: flex;
  align-items: center;
}

#export-md-btn:hover {
  opacity: 0.7;
}

#export-md-btn.hidden {
  display: none;
}

/* Selected todo item (multi-select for export) */
#todo-list li.selected {
  background: rgba(33, 150, 243, 0.08);
  outline: 2px solid rgba(33, 150, 243, 0.4);
  border-radius: 6px;
}

/* Move todos modal */
/* ── Export modal ─────────────────────────────────────────────── */
#export-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1050;
}

#export-modal.hidden {
  display: none;
}

#export-modal-content {
  background: white;
  padding: 24px;
  border-radius: 10px;
  width: 80%;
  max-width: 340px;
  position: relative;
}

#export-modal-content h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.export-item-count {
  font-size: 13px;
  color: #666;
  margin: 0 0 14px;
}

#export-modal-content label[for="export-filename"] {
  display: block;
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
}

.export-filename-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 20px;
}

.export-filename-wrapper input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  min-width: 0;
}

.export-filename-ext {
  font-size: 14px;
  color: #888;
  white-space: nowrap;
}

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

.modal-secondary-btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: white;
  cursor: pointer;
  font-size: 14px;
}

.modal-primary-btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  background: #4a9af5;
  color: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.modal-primary-btn:hover { background: #3a8ae0; }
.modal-secondary-btn:hover { background: #f5f5f5; }

/* ── Move todos modal ─────────────────────────────────────────── */
#move-todos-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1050;
}

#move-todos-modal.hidden {
  display: none;
}

#move-todos-content {
  background: white;
  padding: 24px;
  border-radius: 10px;
  width: 80%;
  max-width: 360px;
  position: relative;
}

#move-todos-content fieldset {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 10px 14px;
  text-align: left;
}

#move-todos-content legend {
  font-size: 13px;
  color: #666;
}

#move-todos-content label {
  display: block;
  margin: 4px 0;
  font-size: 14px;
  cursor: pointer;
}

#move-todos-confirm {
  background-color: #2196F3;
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
}

#move-todos-confirm:hover {
  background-color: #1565C0;
}

/* Move todos button in header */
#move-todos-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  color: inherit;
  display: flex;
  align-items: center;
}

#move-todos-btn:hover {
  opacity: 0.7;
}

#move-todos-btn.hidden {
  display: none;
}

/* Drag-and-drop reorder */
.drag-handle {
  cursor: grab;
  user-select: none;
  padding: 0 6px 0 2px;
  font-size: 16px;
  opacity: 0.35;
  flex-shrink: 0;
}

.drag-handle:hover {
  opacity: 0.7;
}

#todo-list li.dragging {
  opacity: 0.4;
}

#todo-list li.drop-above {
  border-top: 2px solid #2196F3;
}

#todo-list li.drop-below {
  border-bottom: 2px solid #2196F3;
}

/* ─── Share-success modal ───────────────────────────────────────────────────── */
#share-success-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1050;
}

#share-success-modal.hidden {
  display: none;
}

#share-success-content {
  background: white;
  padding: 24px;
  border-radius: 10px;
  width: 80%;
  max-width: 380px;
  position: relative;
}

#share-success-content h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.share-success-desc {
  font-size: 13px;
  color: #666;
  margin: 0 0 10px;
}

.share-success-link {
  display: block;
  font-size: 13px;
  word-break: break-all;
  color: #4a9af5;
  margin-bottom: 20px;
}
