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

/* ── Theme variables ───────────────────────────────────── */
:root {
  --bg-primary:    #111116;
  --bg-secondary:  #1a1a22;
  --bg-tertiary:   #222230;
  --surface:       rgba(255,255,255,0.05);
  --surface-hover: rgba(255,255,255,0.09);
  --surface-active: rgba(255,255,255,0.12);
  --border:        rgba(255,255,255,0.08);
  --border-hover:  rgba(255,255,255,0.15);
  --text-primary:  #f0ede6;
  --text-secondary:#a09a90;
  --text-muted:    #5e5a54;
  --accent:        #d4a843;
  --accent-soft:   #c9a84c;
  --accent-rgb:    212, 168, 67;
  --accent-dim:    rgba(212, 168, 67, 0.12);
  --accent-glow:   rgba(212, 168, 67, 0.25);
  --danger:        #e05c5c;
  --danger-dim:    rgba(224, 92, 92, 0.12);
  --success:       #4ade80;
  --success-dim:   rgba(74, 222, 128, 0.10);
  --sidebar-w:     68px;
  --radius:        14px;
  --radius-sm:     10px;
  --radius-xs:     6px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.3);
  --shadow-lg:     0 12px 40px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.3);
  --transition:    0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body.light {
  --bg-primary:    #f5f0e8;
  --bg-secondary:  #ece7dd;
  --bg-tertiary:   #e2ddd3;
  --surface:       rgba(0,0,0,0.04);
  --surface-hover: rgba(0,0,0,0.07);
  --surface-active: rgba(0,0,0,0.10);
  --border:        rgba(0,0,0,0.08);
  --border-hover:  rgba(0,0,0,0.15);
  --text-primary:  #1c1a16;
  --text-secondary:#6a6258;
  --text-muted:    #9a9288;
  --accent:        #3d6d9e;
  --accent-soft:   #4a78a8;
  --accent-rgb:    61, 109, 158;
  --accent-dim:    rgba(61, 109, 158, 0.10);
  --accent-glow:   rgba(61, 109, 158, 0.20);
  --danger:        #c0392b;
  --danger-dim:    rgba(192, 57, 43, 0.10);
  --success:       #2d9e5f;
  --success-dim:   rgba(45, 158, 95, 0.10);
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.05);
  --shadow-lg:     0 12px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
}

/* ── Base ──────────────────────────────────────────────── */
body {
  font-family: 'Lexend', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}

.app {
  display: flex;
  height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0 20px;
  gap: 4px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.sidebar-brand {
  width: 38px;
  height: 38px;
  margin-bottom: 20px;
  color: var(--accent);
  opacity: 0.9;
  transition: opacity var(--transition), transform var(--transition);
}
.sidebar-brand:hover { opacity: 1; transform: scale(1.05); }
.sidebar-brand svg { width: 100%; height: 100%; }

.nav-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn:hover {
  color: var(--text-secondary);
  background: var(--surface);
}
.nav-btn.active {
  color: var(--accent);
  background: var(--accent-dim);
}
.nav-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

/* ── Main Content ──────────────────────────────────────── */
.content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
}

.section {
  display: none;
  padding: 36px 44px;
  min-height: 100vh;
}
.section.active { display: block; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.section-header h1 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* ── Buttons ──────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #fff;
  border: none;
  padding: 9px 20px;
  border-radius: var(--radius-xs);
  font-family: 'Lexend', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.25);
}
.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(var(--accent-rgb), 0.35);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 9px 20px;
  border-radius: var(--radius-xs);
  font-family: 'Lexend', sans-serif;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
}

.btn-icon {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-icon svg { width: 15px; height: 15px; }
.btn-icon:hover { background: var(--surface-hover); color: var(--text-secondary); }
.btn-icon.danger:hover { background: var(--danger-dim); color: var(--danger); }

/* ── Bookmarks ────────────────────────────────────────── */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.category-tile {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.category-tile:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}
.category-tile.dragging-tile { opacity: 0.4; }
.category-tile.drag-over-tile {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-md);
}

.tile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.tile-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.tile-title-input {
  font-family: 'Lexend', sans-serif;
  font-size: 14px;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  padding: 4px 8px;
  outline: none;
  width: 140px;
}

.tile-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition);
}
.category-tile:hover .tile-actions { opacity: 1; }

.bookmark-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bookmark-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--radius-xs);
  transition: background var(--transition);
  cursor: default;
}
.bookmark-item:hover { background: var(--surface); }
.bookmark-item.dragging { opacity: 0.4; }

.bookmark-favicon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
}

.bookmark-name {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--transition);
}
.bookmark-name:hover { color: var(--accent); }

.bookmark-item-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition);
}
.bookmark-item:hover .bookmark-item-actions { opacity: 1; }

.add-bookmark-form {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: var(--surface);
  border-radius: var(--radius-sm);
}
.add-bookmark-form input {
  font-family: 'Lexend', sans-serif;
  font-size: 12px;
  padding: 7px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}
.add-bookmark-form input:focus { border-color: var(--accent); }
.add-bookmark-form input::placeholder { color: var(--text-muted); }
.add-bookmark-form-actions { display: flex; gap: 6px; justify-content: flex-end; }

.bookmark-edit-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: var(--surface);
  border-radius: var(--radius-sm);
}
.bookmark-edit-wrap input {
  font-family: 'Lexend', sans-serif;
  font-size: 12px;
  padding: 6px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  outline: none;
}
.bookmark-edit-wrap input:focus { border-color: var(--accent); }
.bookmark-edit-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ── Tasks ────────────────────────────────────────────── */
.view-toggle {
  display: flex;
  gap: 0;
  background: var(--surface);
  border-radius: var(--radius-xs);
  padding: 3px;
}

.view-btn {
  width: 34px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.view-btn svg { width: 16px; height: 16px; }
.view-btn:hover { color: var(--text-secondary); }
.view-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.tasks-add-form {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.task-text-input,
.task-date-input,
.task-tags-input {
  font-family: 'Lexend', sans-serif;
  font-size: 13px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}
.task-text-input:focus,
.task-date-input:focus,
.task-tags-input:focus { border-color: var(--accent); }
.task-text-input::placeholder,
.task-tags-input::placeholder { color: var(--text-muted); }

.tasks-table-wrapper {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.tasks-table {
  width: 100%;
  border-collapse: collapse;
}

.tasks-table thead th {
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.tasks-table tbody td {
  padding: 11px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.tasks-table tbody tr:last-child td { border-bottom: none; }

.tasks-table tbody tr:hover { background: var(--surface); }
.tasks-table tbody tr.task-done { opacity: 0.45; }
.tasks-table tbody tr.task-urgent td:nth-child(3) {
  color: var(--danger);
  font-weight: 500;
}
.tasks-table tbody tr.task-dragging { opacity: 0.3; }
.tasks-table tbody tr.task-drag-over {
  box-shadow: inset 0 -2px 0 var(--accent);
}

.task-name-cell {
  cursor: pointer;
  transition: color var(--transition);
}
.task-name-cell:hover { color: var(--accent); }

.task-cb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-hover);
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: all var(--transition);
}
.task-cb:hover { border-color: var(--accent); }
.task-cb:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.task-cb:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.task-tag {
  display: inline-block;
  font-size: 11px;
  padding: 3px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  margin: 1px 3px 1px 0;
  font-weight: 400;
}

.task-actions { display: flex; gap: 2px; }

.sort-header {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sort-btn {
  width: 22px;
  height: 22px;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.sort-btn svg { width: 14px; height: 14px; }
.sort-btn:hover { color: var(--text-secondary); background: var(--surface); }
.sort-btn.sort-asc, .sort-btn.sort-desc { color: var(--accent); }

.filter-row th { padding: 0 14px 10px !important; border-bottom: 1px solid var(--border) !important; background: var(--surface) !important; }

.filter-input {
  font-family: 'Lexend', sans-serif;
  font-size: 11px;
  width: 100%;
  padding: 6px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}
.filter-input:focus { border-color: var(--accent); }
.filter-input::placeholder { color: var(--text-muted); }

.drag-handle-cell { width: 20px; }
.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  opacity: 0.4;
  transition: opacity var(--transition);
  display: flex;
  align-items: center;
}
.drag-handle:hover { opacity: 1; }
.task-draggable { cursor: default; }

/* ── Kanban ───────────────────────────────────────────── */
.section.kanban-active { padding-right: 20px; }
.section.kanban-active .content { overflow-x: auto; }

.kanban-board {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 20px;
  min-height: calc(100vh - 140px);
}

.kanban-col {
  min-width: 270px;
  max-width: 320px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.kanban-col.col-dragging { opacity: 0.4; }
.kanban-col.col-drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-md);
}

.kanban-col-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  cursor: grab;
}

.kanban-col-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.kanban-col-title-input {
  font-family: 'Lexend', sans-serif;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  padding: 3px 8px;
  outline: none;
  width: 120px;
}

.kanban-col-count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.kanban-col-actions {
  display: flex;
  gap: 2px;
  margin-left: auto;
  opacity: 0;
  transition: opacity var(--transition);
}
.kanban-col:hover .kanban-col-actions { opacity: 1; }

.kanban-col-body {
  padding: 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
}
.kanban-col-body.card-drag-over {
  background: var(--accent-dim);
  border-radius: 0 0 var(--radius) var(--radius);
}

.kanban-col-empty {
  text-align: center;
  padding: 20px 10px;
  color: var(--text-muted);
  font-size: 12px;
}

.kanban-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.kanban-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.kanban-card.card-dragging { opacity: 0.3; }
.kanban-card.card-done { opacity: 0.4; }
.kanban-card.card-urgent { border-left: 3px solid var(--danger); }

.kanban-card-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.kanban-card-cb { margin-top: 2px; flex-shrink: 0; }

.kanban-card-text {
  flex: 1;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-primary);
}
.kanban-card-text.done { text-decoration: line-through; color: var(--text-muted); }

.kanban-card-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition);
}
.kanban-card:hover .kanban-card-actions { opacity: 1; }

.kanban-card-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.kanban-card-date { font-size: 11px; color: var(--text-muted); }
.kanban-card-tags { display: flex; flex-wrap: wrap; gap: 4px; }

.kanban-add-form {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: var(--surface);
  border-radius: var(--radius-sm);
}
.kanban-add-form.open { display: flex; }

.kanban-add-input {
  font-family: 'Lexend', sans-serif;
  font-size: 12px;
  padding: 8px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  outline: none;
}
.kanban-add-input:focus { border-color: var(--accent); }
.kanban-add-input::placeholder { color: var(--text-muted); }
.kanban-add-actions { display: flex; gap: 6px; align-items: center; }

.kanban-collapse-btn {
  background: transparent !important;
  transition: transform var(--transition);
}
.kanban-collapse-btn.is-collapsed { transform: rotate(180deg); }
.col-collapsed .kanban-col-body { display: none; }

.kanban-add-col-wrapper { min-width: 200px; flex-shrink: 0; }
.kanban-add-col-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: 'Lexend', sans-serif;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  transition: all var(--transition);
}
.kanban-add-col-btn svg { width: 16px; height: 16px; }
.kanban-add-col-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  color: var(--text-secondary);
}
.kanban-add-col-form {
  padding: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ── Cities ───────────────────────────────────────────── */
.cities-toolbar { display: flex; align-items: center; gap: 12px; }

.unit-toggle {
  display: flex;
  background: var(--surface);
  border-radius: var(--radius-xs);
  padding: 3px;
}

.unit-btn {
  padding: 5px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-family: 'Lexend', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.unit-btn.active { background: var(--accent-dim); color: var(--accent); }

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

.city-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.city-row:hover { border-color: var(--border-hover); box-shadow: var(--shadow-md); }
.city-row.dragging { opacity: 0.4; }
.city-row.drag-over { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.city-drag-handle {
  cursor: grab;
  color: var(--text-muted);
  opacity: 0.4;
  display: flex;
  align-items: center;
  transition: opacity var(--transition);
}
.city-drag-handle:hover { opacity: 1; }

.city-info { flex: 1; min-width: 0; }
.city-name-row { display: flex; align-items: baseline; gap: 8px; }
.city-name { font-size: 15px; font-weight: 500; color: var(--text-primary); }
.city-country { font-size: 12px; color: var(--text-muted); }

.city-time {
  font-size: 18px;
  font-weight: 300;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 160px;
  text-align: right;
}

.city-weather {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 90px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  transition: background var(--transition);
}
.city-weather:hover { background: var(--surface); }
.city-weather-emoji { font-size: 20px; }
.city-weather-temp { font-size: 14px; color: var(--text-secondary); }

.city-empty {
  text-align: center;
  padding: 48px 0;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Time Tracker ─────────────────────────────────────── */
.tt-add-form { display: flex; gap: 10px; margin-bottom: 24px; }

.tt-add-form input {
  flex: 1;
  font-family: 'Lexend', sans-serif;
  font-size: 13px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}
.tt-add-form input:focus { border-color: var(--accent); }
.tt-add-form input::placeholder { color: var(--text-muted); }

.tt-table-wrapper {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.tt-table { width: 100%; border-collapse: collapse; }
.tt-table thead th {
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.tt-table tbody td { padding: 11px 14px; font-size: 13px; border-bottom: 1px solid var(--border); }
.tt-table tbody tr:last-child td { border-bottom: none; }
.tt-table tbody tr:hover { background: var(--surface); }
.tt-table tbody tr.tt-active { background: var(--accent-dim); }
.tt-table tbody tr.tt-dragging { opacity: 0.3; }
.tt-table tbody tr.tt-drag-over { box-shadow: inset 0 -2px 0 var(--accent); }

.tt-project-name-cell { font-weight: 500; color: var(--text-primary); }
.tt-duration-cell { font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.tt-row-actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }

.btn-start, .btn-stop {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-xs);
  font-family: 'Lexend', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-start { background: var(--success-dim); color: var(--success); }
.btn-start:hover { background: rgba(74, 222, 128, 0.2); }
.btn-stop { background: var(--danger-dim); color: var(--danger); }
.btn-stop:hover { background: rgba(224, 92, 92, 0.2); }

/* ── Sidebar stop button ──────────────────────────────── */
.tt-sidebar-stop-wrapper { position: relative; margin-bottom: 4px; }

.tt-sidebar-stop-btn {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--danger-dim);
  border: none; border-radius: var(--radius-sm);
  color: var(--danger); cursor: pointer;
  animation: pulse-stop 2s ease-in-out infinite;
  transition: background var(--transition);
}
.tt-sidebar-stop-btn:hover { background: rgba(224, 92, 92, 0.3); }

@keyframes pulse-stop { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.tt-sidebar-tooltip {
  display: none;
  position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px;
  font-size: 12px; white-space: nowrap; box-shadow: var(--shadow-md);
  z-index: 100; color: var(--text-primary); line-height: 1.5;
}
.tt-sidebar-stop-wrapper:hover .tt-sidebar-tooltip { display: block; }

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

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  max-height: 85vh; overflow-y: auto;
  width: 440px; max-width: 90vw;
}

.modal-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; letter-spacing: -0.02em; }

.modal-input {
  width: 100%;
  font-family: 'Lexend', sans-serif; font-size: 14px;
  padding: 11px 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  outline: none; transition: border-color var(--transition); margin-bottom: 12px;
}
.modal-input:focus { border-color: var(--accent); }
.modal-input::placeholder { color: var(--text-muted); }

.modal-results { max-height: 280px; overflow-y: auto; margin-bottom: 12px; }

.modal-result-item {
  padding: 10px 14px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background var(--transition);
}
.modal-result-item:hover { background: var(--surface-hover); }
.modal-result-item div:first-child { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.modal-result-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

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

/* TT Modal */
.tt-modal { width: 600px; max-width: 95vw; }
.tt-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.tt-modal-name-row { display: flex; align-items: center; gap: 8px; flex: 1; }
.tt-modal-project-title { font-size: 18px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.02em; }
.tt-modal-title {
  font-family: 'Lexend', sans-serif; font-size: 18px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--accent);
  border-radius: var(--radius-xs); color: var(--text-primary);
  padding: 4px 10px; outline: none; width: 200px;
}
.tt-btn-delete-project { margin-left: auto; }
.tt-modal-toolbar { margin-bottom: 14px; }
.tt-modal-body { margin-bottom: 16px; }

.tt-modal-table { width: 100%; border-collapse: collapse; }
.tt-modal-table thead th {
  padding: 10px 12px; font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); text-align: left; border-bottom: 1px solid var(--border);
}
.tt-modal-table tbody td { padding: 9px 12px; font-size: 13px; border-bottom: 1px solid var(--border); }
.tt-modal-table tbody tr:last-child td { border-bottom: none; }
.tt-modal-empty { text-align: center; padding: 24px !important; color: var(--text-muted); font-size: 13px; }

.tt-ev-date { color: var(--text-secondary); }
.tt-ev-note { color: var(--text-secondary); font-size: 12px; }
.tt-modal-row-actions { display: flex; gap: 2px; justify-content: flex-end; }

.tt-date-input, .tt-dur-input, .tt-note-input {
  font-family: 'Lexend', sans-serif; font-size: 12px;
  padding: 5px 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  color: var(--text-primary); outline: none; width: 100%;
}
.tt-date-input:focus, .tt-dur-input:focus, .tt-note-input:focus { border-color: var(--accent); }
.tt-edit-row { background: var(--surface) !important; }
.tt-confirm-btn { color: var(--success) !important; }

.tt-modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding-top: 14px; border-top: 1px solid var(--border);
}

/* ── Settings ─────────────────────────────────────────── */
.settings-list { display: flex; flex-direction: column; gap: 8px; max-width: 560px; }

.settings-item {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 18px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.settings-item--stack { flex-direction: column; align-items: flex-start; }
.settings-item-label { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.settings-item-desc { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.settings-link { color: var(--accent); text-decoration: none; }
.settings-link:hover { text-decoration: underline; }

.settings-section-divider {
  display: flex; align-items: center; gap: 12px; padding: 10px 0; margin-top: 6px;
}
.settings-section-divider::before,
.settings-section-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.settings-section-divider span {
  font-size: 11px; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
}
.settings-section-divider--btn { cursor: pointer; }
.settings-section-divider--btn:hover span { color: var(--text-secondary); }

/* Theme toggle */
.theme-toggle {
  width: 44px; height: 24px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; cursor: pointer; position: relative;
  transition: all var(--transition); flex-shrink: 0;
}
.theme-toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; background: var(--text-muted);
  border-radius: 50%; transition: all var(--transition);
}
.theme-toggle.on { background: var(--accent-dim); border-color: var(--accent); }
.theme-toggle.on::after { transform: translateX(20px); background: var(--accent); }
.theme-icon { display: none; }

.sync-badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 500; }
.sync-badge--on { background: var(--success-dim); color: var(--success); }

.sync-config-textarea {
  width: 100%; min-height: 120px; font-family: monospace; font-size: 12px;
  padding: 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary); resize: vertical; outline: none; margin-top: 10px;
}
.sync-config-textarea:focus { border-color: var(--accent); }
.sync-action-btn { margin-top: 10px; }
.sync-redirect-block { margin-top: 8px; }
.sync-redirect-hint { font-size: 11px; color: var(--text-muted); }
.sync-redirect-uri {
  display: block; margin-top: 4px; padding: 6px 10px;
  background: var(--surface); border-radius: var(--radius-xs); font-size: 12px; word-break: break-all;
}
.sync-avatar { width: 32px; height: 32px; border-radius: 50%; }
.sync-error { padding: 8px 14px; color: var(--danger); font-size: 13px; }
.sync-google-btn { display: inline-flex !important; align-items: center; gap: 8px; }

/* User Manual */
.manual-chevron { transition: transform var(--transition); color: var(--text-muted); }
.manual-chevron--open { transform: rotate(180deg); }

.user-manual-panel { max-width: 560px; margin-top: 6px; }
.user-manual-content {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
  font-size: 13px; line-height: 1.7; color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}
.user-manual-content h1 { font-size: 22px; font-weight: 600; margin: 24px 0 10px; color: var(--text-primary); }
.user-manual-content h2 { font-size: 18px; font-weight: 600; margin: 22px 0 8px; color: var(--text-primary); }
.user-manual-content h3 { font-size: 15px; font-weight: 600; margin: 18px 0 6px; color: var(--text-primary); }
.user-manual-content h4 { font-size: 14px; font-weight: 600; margin: 14px 0 4px; color: var(--text-primary); }
.user-manual-content h1:first-child { margin-top: 0; }
.user-manual-content p { margin-bottom: 10px; }
.user-manual-content ul, .user-manual-content ol { margin-bottom: 10px; padding-left: 20px; }
.user-manual-content li { margin-bottom: 4px; }
.user-manual-content a { color: var(--accent); text-decoration: none; }
.user-manual-content a:hover { text-decoration: underline; }
.user-manual-content pre {
  background: var(--bg-primary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px; overflow-x: auto; margin-bottom: 10px;
}
.user-manual-content code {
  font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px;
  background: var(--surface); padding: 2px 6px; border-radius: 4px;
}
.user-manual-content pre code { background: none; padding: 0; }
.user-manual-content hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.user-manual-content blockquote {
  border-left: 3px solid var(--accent); padding-left: 14px; margin: 10px 0; color: var(--text-muted);
}
.user-manual-content img, .manual-img { max-width: 100%; border-radius: var(--radius-sm); margin: 8px 0; }
.manual-screenshot {
  background: var(--surface); border-radius: var(--radius-sm);
  padding: 12px; margin: 10px 0; text-align: center;
}
.user-manual-loading { text-align: center; color: var(--text-muted); padding: 24px 0; }

/* ── Task Detail Modal ────────────────────────────────── */
.task-detail-modal { width: 560px; max-width: 95vw; }
.task-detail-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.task-detail-title {
  flex: 1; font-family: 'Lexend', sans-serif; font-size: 18px; font-weight: 600;
  background: transparent; border: none; border-bottom: 2px solid transparent;
  color: var(--text-primary); outline: none; padding: 4px 0;
  transition: border-color var(--transition);
}
.task-detail-title:focus { border-color: var(--accent); }

.task-detail-meta { display: flex; gap: 14px; margin-bottom: 18px; }
.task-detail-field { display: flex; flex-direction: column; gap: 4px; }
.task-detail-label {
  font-size: 11px; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted);
}
.task-detail-input {
  font-family: 'Lexend', sans-serif; font-size: 13px; padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xs); color: var(--text-primary);
  outline: none; transition: border-color var(--transition);
}
.task-detail-input:focus { border-color: var(--accent); }
.task-detail-input::placeholder { color: var(--text-muted); }

.task-detail-desc-section { margin-bottom: 18px; }
.task-detail-desc-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.task-detail-toolbar { display: flex; gap: 2px; }
.toolbar-btn {
  width: 30px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: var(--radius-xs);
  color: var(--text-muted); cursor: pointer; transition: all var(--transition);
}
.toolbar-btn svg { width: 15px; height: 15px; }
.toolbar-btn:hover { background: var(--surface); color: var(--text-secondary); }
.toolbar-btn.active { background: var(--accent-dim); color: var(--accent); }
.toolbar-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; align-self: center; }

.task-detail-desc {
  min-height: 120px; padding: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Lexend', sans-serif; font-size: 13px; line-height: 1.6;
  color: var(--text-primary); outline: none;
  transition: border-color var(--transition);
}
.task-detail-desc:focus { border-color: var(--accent); }
.task-detail-desc:empty::before { content: attr(data-placeholder); color: var(--text-muted); }
.task-detail-desc a { color: var(--accent); }

.link-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent-dim); border-radius: var(--radius-xs); padding: 1px 6px;
}
.link-chip a { color: var(--accent); text-decoration: none; font-size: 12px; }
.link-open-btn {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: var(--accent); cursor: pointer; padding: 0;
}
.link-open-btn svg { width: 12px; height: 12px; }

.task-detail-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding-top: 14px; border-top: 1px solid var(--border);
}

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

/* ── Utilities ───────────────────────────────────────────── */
.hidden { display: none !important; }
input[type="date"] { color-scheme: dark; }
body.light input[type="date"] { color-scheme: light; }
.cities-list:has(.city-row) .city-empty { display: none; }

/* ── Login Screen ───────────────────────────────────────── */
.login-screen {
  display: flex; align-items: center; justify-content: center; height: 100vh;
  background: var(--bg-primary);
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(var(--accent-rgb), 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(var(--accent-rgb), 0.05) 0%, transparent 50%);
}

.login-card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 20px; padding: 48px 40px 40px;
  width: 400px; max-width: 90vw; text-align: center;
  box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.login-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent); opacity: 0.6;
}

.login-logo {
  color: var(--accent); margin-bottom: 16px;
  filter: drop-shadow(0 2px 8px rgba(var(--accent-rgb), 0.3));
}

.login-title { font-size: 24px; font-weight: 600; margin-bottom: 6px; letter-spacing: -0.03em; }
.login-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 28px; }

/* Login tabs */
.login-tabs {
  display: flex; gap: 0; margin-bottom: 24px;
  background: var(--surface); border-radius: var(--radius-sm);
  border: 1px solid var(--border); overflow: hidden;
}
.login-tab {
  flex: 1; padding: 10px 0; background: none; border: none;
  color: var(--text-muted); font-family: 'Lexend', sans-serif;
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all var(--transition);
}
.login-tab.active {
  background: var(--accent); color: var(--bg-primary); font-weight: 600;
}
.login-tab:not(.active):hover { color: var(--text-primary); }

.login-tab-content {
  display: flex; flex-direction: column; gap: 12px;
}

.login-input {
  width: 100%; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-family: 'Lexend', sans-serif; font-size: 14px;
  outline: none; transition: border-color var(--transition);
  box-sizing: border-box;
}
.login-input:focus { border-color: var(--accent); }
.login-input::placeholder { color: var(--text-muted); }

.login-submit {
  width: 100%; padding: 13px 0; font-size: 14px; font-weight: 600;
  margin-top: 4px;
}

.login-error { color: var(--danger); font-size: 12px; margin-top: 12px; min-height: 18px; }
.login-success { color: var(--success, #4ade80); font-size: 12px; margin-top: 4px; min-height: 18px; }

/* Settings inputs and forms */
.settings-input {
  width: 100%; padding: 10px 14px;
  background: var(--bg-primary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-family: 'Lexend', sans-serif; font-size: 13px;
  outline: none; transition: border-color var(--transition);
  box-sizing: border-box;
}
.settings-input:focus { border-color: var(--accent); }
.settings-input::placeholder { color: var(--text-muted); }

select.settings-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 32px; cursor: pointer;
}

.settings-item-stack {
  flex-direction: column; align-items: stretch;
}

.change-password-form {
  display: flex; flex-direction: column; gap: 10px; margin-top: 10px;
}
.change-password-form .btn-primary { align-self: flex-start; }

.settings-msg { font-size: 12px; min-height: 16px; margin-top: 4px; }
.settings-msg-error { color: var(--danger); }
.settings-msg-success { color: var(--success, #4ade80); }

/* Admin panel */
.admin-user-list {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px;
}
.admin-user-row {
  display: grid; grid-template-columns: 1fr 1.5fr auto 36px;
  gap: 10px; align-items: center;
  padding: 10px 14px; background: var(--bg-primary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.admin-user-name { font-weight: 500; font-size: 13px; }
.admin-user-email { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.admin-user-role {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--accent); font-weight: 600;
}
.admin-delete-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; background: none; border: 1px solid transparent;
  border-radius: var(--radius-xs); color: var(--text-muted);
  cursor: pointer; transition: all var(--transition);
}
.admin-delete-btn:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-dim); }

.admin-create-form {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.admin-create-form .btn-primary { grid-column: 1 / -1; justify-self: start; }
